We help IT Professionals succeed at work.

Open Dialog box to specific folder

jdc1944
jdc1944 asked
on
257 Views
Last Modified: 2017-04-21
I have a word document with a command button.  Behind this command button is some vba to select and open another file.  What I want to happen is when the open file dialog box is displayed, for it to point to a specific directory.  I’ve done some looking on the net around this and it seems that using .name and then the folder path should work however it doesn’t, it just opens a random directory (appears to be the last directory used).

Can anyone help get this open file dialog box to go straight to a specific folder?

    Set dlg = Dialogs(wdDialogFileOpen)
    With Dialogs(wdDialogFileOpen)
        .Name = "C:\test folder\"
        If dlg.Display = -1 Then strPath = dlg.Name
    End With
Comment
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Many thanks for your assistance, it works perfectly.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.