VBA to show a folder navigation window

J

Jon

I'd like to write a VBA programme to change the default directory that Word
uses for clip art pictures. In Word 2003, this can be selected in Tools >
Options, File Locations tab, Clipart Pictures, but I'd like to make it
easier by having a toolbar button that brings up a dialogue box in which the
user can navigate to the desired folder then set the Clipart Pictures folder
to this location. How do I bring up such a dialogue box in VBA?
 
D

Dave Lett

Hi Jon,

This is the best that I can come up with:

SendKeys "%f{DOWN}%m"
Dialogs(wdDialogToolsOptionsFileLocations).Show

HTH,
Dave
 
J

Jon

Hi,

Thanks for your answer.

Does this mean that there isn't a way in VB to bring up a dialogue box for
folder navigation?

Jon.
 
J

Jay Freedman

Hi Jon,

It doesn't mean that at all. There are several ways -- see
http://word.mvps.org/FAQs/MacrosVBA/BrowsDialog.htm.

The advantage of Dave's solution is that when the user selects a folder in
the ToolsOptionsFileLocations dialog and clicks OK, it automatically changes
the Clipart location; your code doesn't have to do anything else. If you
used one of the generic folder browser methods, then your code would have to
separately set the Clipart location to the selected folder.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top