Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Aug 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is there a list of properties relating to each Dialog? For example, I want to create a small macro that displays the FileOpen dialog with a file type of "Plain text" already selected, and need to know how to refer to that property. Something like this:
    Code:
    Sub SaveAsText()
    	Dim MyDialog As Dialog
    	Set MyDialog = Dialogs(wdDialogFileSaveAs)
    	With MyDialog
    		.???????? = "Plain text"
    		.Show
    	End With
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The following is for Word 2003. These online help topics can also be found in the built-in help for Word VBA.

    Displaying Built-in Word Dialog Boxes
    Built-in Dialog Box Argument Lists

    For wdDialogFileSaveAs the arguments are:
    Name, Format, LockAnnot, Password, AddToMru, WritePassword, RecommendReadOnly, EmbedFonts, NativePictureFormat, FormsData, SaveAsAOCELetter, WriteVersion, VersionDesc, InsertLineBreaks, AllowSubstitutions, LineEnding, AddBiDiMarks

    For the Open and Save As dialogs, I find it easier to use Application.FileDialog, since it is more clearly documented in the help files. See:

    FileDialog Object
    Filters Property

  3. #3
    Lounger
    Join Date
    Aug 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='799262' date='22-Oct-2009 10:06']The following is for Word 2003. These online help topics can also be found in the built-in help for Word VBA.

    Displaying Built-in Word Dialog Boxes
    Built-in Dialog Box Argument Lists

    For wdDialogFileSaveAs the arguments are:
    Name, Format, LockAnnot, Password, AddToMru, WritePassword, RecommendReadOnly, EmbedFonts, NativePictureFormat, FormsData, SaveAsAOCELetter, WriteVersion, VersionDesc, InsertLineBreaks, AllowSubstitutions, LineEnding, AddBiDiMarks

    For the Open and Save As dialogs, I find it easier to use Application.FileDialog, since it is more clearly documented in the help files. See:

    FileDialog Object
    Filters Property[/quote]
    That's terrific, thanks. I've never been able to find that list before. Now I'll be really dangerous!!!

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Hans, using that search string makes the same list appear in Excel VBA help too.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The way to specify the arguments in Excel is rather strange.
    The Show method of the Dialog object has arguments Arg1, Arg2, ... corresponding to the named arguments listed in the help in the exact order they're listed there.
    For example, the xlDialogAlignment dialog has arguments horiz_align, wrap, vert_align, orientation, add_indent.
    Now suppose you want to preset the Wrap Text check box "on" (ticked). Wrap is the second argument, so you'd use

    Application.Dialogs(xlDialogAlignment).Show Arg2:=True

    And unlike in Word, you can't retrieve the value set by the user, except by looking at the result of the dialog, in this example at the alignment properties of the selected cells.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •