Use of Wild Cards in ChangeFileOpenDirectory

D

David

I am trying to develop a macro that will copy a word
document into a client's folder that is within a master
folder H:\All Clients. The document in question is a
selection from a mailmerge file where we are trying to
keep copies of such documents on clients' electronic
archives.

The clients' folders are consistently named with a five
digit number followed by the client's name. The macro I
have can already determine the number from the client
reference within the document I want to save.

My problem is that although the file search facility has
a wild card facility I can find no way of doing a wild
card entry for a folder.

Thus if I am trying to use to save a file to "60020 Mr J
Smith" I need some way of using ChangeFileOpenDirectory
to use "60020*"

Hope someone out there can point me in the right direction

Thanks!
 
D

Doug Robbins - Word MVP

Hi David,

See the article "How to get the names of all the folders in the folder tree,
starting from a specified folder" at:

http://word.mvps.org/FAQs/MacrosVBA/ReadFoldersIntoArray.htm

Using either that or a modification of it, you should then be able to
iterate through the folders to locate the one where there is a match with
the 5 digits from the file name.
--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

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