none
DialogContentControlProperties RRS feed

  • Question

  • Select a CC and run:

    Sub ScratchMacro()
    With Dialogs(wdDialogContentControlProperties)
     MsgBox .Show
    End With
    End Sub

    The dialog returns 0 regardless if "OK" or "CANCEL" is clicked.

    This makes programming with CCs difficult.  Does anyone know how to detect the "CANCEL" event using this dialog?

    Thanks.


    Greg Maxey Please visit my website at: http://gregmaxey.mvps.org/word_tips.htm
    Friday, January 21, 2011 4:47 PM

Answers

  • Hello Bessie,

    That is what Greg is already doing - for most dialogs, you get a different result for OK (-1) and Cancel (0).

    But not for this dialog.

    IMO, it's an error in the coding of the dialog box. Other than a fix to Word 2007 and Word 2010, the simplest workaround I can think of is for Greg to code his own version of the Dialog as a Userform. I suppose it would also be possible to use Win32 to intercept the Windows event messages for the Dialog Box and determine which button was pressed, but I don't know how to do that.

    If anyone is able to chase up this problem with the Dev. team, it would also be extremely useful if

     a. someone could get an updated list of the Dialg boxes available. I am sure that many are not documented for a reason (e.g. they may be intended for "internal use" or be deprecated), but AFAICS a reason why so many do not have a named dialog constant (cf. wdDialogContentControlProperties) may be that there is a 255/256 limit on the number of constants that you can define in a single enum - i.e. someone on the dev. team may have had to pick and choose which Dialogs have named constants.

     b. there was an up-to-date list of the dialog-specific property names for each Dialog. MSDN has a list for Word 2003 (and perhaps a suggestion to consult the Word 95 WordBasic documentation), but not AFAICS for 2007. Alternatively, I wondered whether it might be possible to write a small piece of code - perhaps using .NET Reflection - that could get an IDispatchEx interface for each dialog and retrieve the list of dialog-specific property names.

    Thanks for listening!


    Peter Jamieson
    • Marked as answer by Bessie Zhao Tuesday, February 15, 2011 5:36 AM
    Monday, January 24, 2011 9:42 AM
  • Hi,

    Thank you to everyone for your input to this thread.

     

    We’ve verified the behavior with the
    Dialogs(wdDialogContentControlProperties) dialog as described by Greg Maxey for Word 2007 and 2010.

     

    The behavior has been reported to the Office Product team.

     

    Thus, we'll mark this thread as answered.

     

    Regards,


    Bill Go - MSFT
    Sunday, March 13, 2011 8:59 PM
    Answerer

All replies

  • Hello Greg,

    Thanks for posting. I think you could use the return value of Show method to check if "Ok" or "Cancel" is clicked. For more information, please see this MSDN page: http://msdn.microsoft.com/en-us/library/bb221447(office.12).aspx.

    If this post does not help you, just feel free to follow up. Have a nice day. 


    Bessie Zhao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 24, 2011 6:46 AM
  • Hello Bessie,

    That is what Greg is already doing - for most dialogs, you get a different result for OK (-1) and Cancel (0).

    But not for this dialog.

    IMO, it's an error in the coding of the dialog box. Other than a fix to Word 2007 and Word 2010, the simplest workaround I can think of is for Greg to code his own version of the Dialog as a Userform. I suppose it would also be possible to use Win32 to intercept the Windows event messages for the Dialog Box and determine which button was pressed, but I don't know how to do that.

    If anyone is able to chase up this problem with the Dev. team, it would also be extremely useful if

     a. someone could get an updated list of the Dialg boxes available. I am sure that many are not documented for a reason (e.g. they may be intended for "internal use" or be deprecated), but AFAICS a reason why so many do not have a named dialog constant (cf. wdDialogContentControlProperties) may be that there is a 255/256 limit on the number of constants that you can define in a single enum - i.e. someone on the dev. team may have had to pick and choose which Dialogs have named constants.

     b. there was an up-to-date list of the dialog-specific property names for each Dialog. MSDN has a list for Word 2003 (and perhaps a suggestion to consult the Word 95 WordBasic documentation), but not AFAICS for 2007. Alternatively, I wondered whether it might be possible to write a small piece of code - perhaps using .NET Reflection - that could get an IDispatchEx interface for each dialog and retrieve the list of dialog-specific property names.

    Thanks for listening!


    Peter Jamieson
    • Marked as answer by Bessie Zhao Tuesday, February 15, 2011 5:36 AM
    Monday, January 24, 2011 9:42 AM
  • Peter,

    You're right.  The wddialogsInsertSymbols is another one that doesn't work if I remember correctly.  I thought about creating my own dialog and sort of did in my old Map Content Controls but with the introduction of checkboxes and the ability to set there symbols it would be a gnarly undertaking for a person of my limited skills.

    The right answer IMHO is for MS to stop introducing new features until they are tested and ready for use.  Or at least if they do want to hurl out non-functioning software then make an effort to correct it when it is broke. Case in point the CC OnExit event now broken for going on 6 years.

    "Peter Jamieson" wrote in message news:961a0985-fe70-497e-aee0-55ef13e347f3@communitybridge.codeplex.com...

    Hello Bessie,

    That is what Greg is already doing - for most dialogs, you get a different result for OK (-1) and Cancel (0).

    But not for this dialog.

    IMO, it's an error in the coding of the dialog box. Other than a fix to Word 2007 and Word 2010, the simplest workaround I can think of is for Greg to code his own version of the Dialog as a Userform. I suppose it would also be possible to use Win32 to intercept the Windows event messages for the Dialog Box and determine which button was pressed, but I don't know how to do that.

    If anyone is able to chase up this problem with the Dev. team, it would also be extremely useful if

    a. someone could get an updated list of the Dialg boxes available. I am sure that many are not documented for a reason (e.g. they may be intended for "internal use" or be deprecated), but AFAICS a reason why so many do not have a named dialog constant (cf. wdDialogContentControlProperties) may be that there is a 255/256 limit on the number of constants that you can define in a single enum - i.e. someone on the dev. team may have had to pick and choose which Dialogs have named constants.

    b. there was an up-to-date list of the dialog-specific property names for each Dialog. MSDN has a list for Word 2003 (and perhaps a suggestion to consult the Word 95 WordBasic documentation), but not AFAICS for 2007. Alternatively, I wondered whether it might be possible to write a small piece of code - perhaps using .NET Reflection - that could get an IDispatchEx interface for each dialog and retrieve the list of dialog-specific property names.

    Thanks for listening!

    Peter Jamieson


    Greg Maxey Please visit my website at: http://gregmaxey.mvps.org/word_tips.htm
    Tuesday, January 25, 2011 10:20 PM
  • > an up-to-date list of the dialog-specific property names for each Dialog
     
    Also, something I've asked for at every MVP Summit for, oh, the last 7 or 8 years is to
    have the help topic on "Built-In Dialog Box Argument Lists" expanded to include the data
    type or enumeration for each argument. Still no action on this.
     

    Jay Freedman
    MS Word MVP  FAQ: http://word.mvps.org
    Tuesday, January 25, 2011 10:33 PM
  • Your chance to ask it again is coming up.


    Hope this helps.

    Doug Robbins - Word MVP,
    dkr[atsymbol]mvps[dot]org
    Posted via the Community Bridge

    "Jay Freedman [MVP]" wrote in message news:f130fd05-5577-4e62-b59f-990aeeae7f0b@communitybridge.codeplex.com...

    an up-to-date list of the dialog-specific property names for each Dialog

    Also, something I've asked for at every MVP Summit for, oh, the last 7 or 8 years is to
    have the help topic on "Built-In Dialog Box Argument Lists" expanded to include the data
    type or enumeration for each argument. Still no action on this.


    Jay Freedman
    MS Word MVP  FAQ: http://word.mvps.org


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    Wednesday, January 26, 2011 5:56 AM
  • Hi Greg

    <<Case in point the CC OnExit event now broken for going on 6 years.>>

    As far as I know, it's been fixed in Office 2010?


    Cindy Meister, VSTO/Word MVP
    Wednesday, January 26, 2011 6:14 AM
    Moderator
  • Cindy,

    Yes it has.  That only adds insult to injury.  There is a fix to the problem but MS chooses not to fix the application that introduced CCs which millions of people have bought and paid for.  Why isn't the fix pushed to Word2007?

    The dialog is broken in both versions.  Additionally, and even though there is supposed to be compatibility between Word2010 and Word2007, it is possible to add ContentControls to a Word2010 document that may or may not be accessible using the ID property in Word2207 :-(

    All of these unresolved issues makes development involving CCs very cumbersome.

    If you want to build CCs with VBA and use the properties dialog you don't know if the user actually sets properties or cancels.  Worse if you try to select a CC created in a Word2010 document on a PC using Word2007 using the "ID" property Word2007 may play along and actually select the CC or it may generate a RTE.  The issue is that Word2010 can assign ID numbers that are too large for Word2007 to accept:

    ActiveDocument.ContentControls("X").Range.Select    Where "X" is the ID and may be too large.

    If you have both version of Word and want to see a document that illustrates the issue with a work around then let me know and I can send it to you.  The problem is kind of weird because Word2007 can contain IDs that are too large and it can even tell you what that ID is.  It just can't select it using the simple line of code shown above.  The work around requires your to cycle trough the entire document collection of CCs (which can mean every storyrng, linked storyrng, and even every textrange of every textframe of every shape in the headers or footers) until the .ID of the CC matches "X".

    "Cindy Meister [MVP]" wrote in message news:5ba8fbdf-5d9c-47b6-a54a-6ac612c3548c@communitybridge.codeplex.com...

    Hi Greg

    <<Case in point the CC OnExit event now broken for going on 6 years.>>

    As far as I know, it's been fixed in Office 2010?

    Cindy Meister, VSTO/Word MVP


    Greg Maxey Please visit my website at: http://gregmaxey.mvps.org/word_tips.htm
    Wednesday, January 26, 2011 4:36 PM
  • > Also, something I've asked for at every MVP Summit for, oh, the last 7 or 8 years is to

    I would have thought that it would take someone with access to the source code, a reasonable knowledge of its structure, a modest set of text processing tools and a good list of "stuff it would be useful to have documented" a few hours to produce some /very useful stuff/ that MS could put on MSDN without causing its revenue streams to stutter. You never know, it might be worth asking for that instead!


    Peter Jamieson
    Wednesday, January 26, 2011 4:47 PM
  • Hi,

    Thank you to everyone for your input to this thread.

     

    We’ve verified the behavior with the
    Dialogs(wdDialogContentControlProperties) dialog as described by Greg Maxey for Word 2007 and 2010.

     

    The behavior has been reported to the Office Product team.

     

    Thus, we'll mark this thread as answered.

     

    Regards,


    Bill Go - MSFT
    Sunday, March 13, 2011 8:59 PM
    Answerer