Results 1 to 6 of 6
  1. #1
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Activate Save dialog using VBA? (Word2000>)

    How do you get the save as and open dialog boxes to activate using VBA???
    In excel you use the Application.GetOpenFileName and Application.GetSaveAsFileName methods!!!
    Regards,
    Rudi

  2. #2
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Boston, Massachusetts, USA
    Posts
    389
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Activate Save dialog using VBA? (Word2000>)

    Dialogs(wdDialogFileSaveAs).Show
    Dialogs(wdDialogFileOpen).Show

    HTH!!!

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Activate Save dialog using VBA? (Word2000>)

    In addition to Andrew's backwards compatible solution, Office XP added a FileDialogs collection that offers more options. However, it will not work in Office 2000, so if you find sample code using FileDialogs, you'll have to rewrite it a bit for backwards compatibility.

  4. #4
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Activate Save dialog using VBA? (Word2000>)

    Thanx guys.
    Just another thing...
    <pre>Sub OpenFile()
    With Dialogs(wdDialogFileOpen)
    .Name = "*.txt"
    .Show
    End With
    End Sub
    </pre>


    This sample code shows a filter for text files when the dialog opens. How will I add code to have the dialog show a certain directory by default. IE, when it opens, it must show the "Letters" directory on the C: drive.
    Regards,
    Rudi

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Activate Save dialog using VBA? (Word2000>)

    I think you might be able to add the path to the .Name property you already have. If not, try a search for posts using ChangeFileOpenDirectory and/or Options.DefaultFilePath combined with that dialog constant; you should find some other options. (Can't search very well on this phone.)

  6. #6
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Activate Save dialog using VBA? (Word2000>)

    Thanx jscher...
    A search finally docked up something!

    The code that does the job looks like this:
    <pre>Sub OpenFile()
    ChangeFileOpenDirectory "C:TestDir"
    With Dialogs(wdDialogFileOpen)
    .Name = "*.txt"
    .Show
    End With
    End Sub
    </pre>


    Cheers!
    Regards,
    Rudi

Posting Permissions

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