Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    May 2002
    Posts
    36
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Use a Word Macro to Open a Folder (2003)

    I’m trying to write a macro that will do the same thing as File/Open but it will open the “file listing dialog box” to a particular folder (e.g., z:word) and then allow me to choose which file to open in that folder/directory.

    When I record the macro, I get to the open dialog box for the desired folder, but I’m unable to turnoff the recorder at the desired folder. I can either cancel the recording or continue until I select a document. I would like the macro to stop at the desired folder and allow the use to select the document to open.

    In doing some research, it seems that I need to write a VBA code to accomplish the task. I have a very limited knowledge base when it comes to writing code.

    I did find the following code:

    Sub OpenFolder()
    Application.Dialogs(wdDialogFileOpen).Show
    End Sub

    It does works; but it opens the last directory/folder that used in Word.

    What additional code/lines do I need to include so it opens to the directory/folder z:word?

    At this point, I’m not even sure if I’m asking the question correctly. Any help or suggestions are appreciated.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Use a Word Macro to Open a Folder (2003)

    Try
    <code>
    Sub OpenFolder()
    With Application.Dialogs(wdDialogFileOpen)
    .Name = "Z:Word"
    .Show
    End With
    End Sub
    </code>
    Note the trailing backslash after the path in the code. This is required.

  3. #3
    Lounger
    Join Date
    May 2002
    Posts
    36
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Re: Use a Word Macro to Open a Folder (2003)

    Hans,

    Thanks for your help. This is perfect!

    Steve

Posting Permissions

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