Thank you for your help. I think this will get me over the hump. I appreciate it.
--
RMC,CPA
That seems to work fine, thanks. I'm guessing that I will soon be needing to
write code to determine what the default path is before
changing to a specified path that everybody will use as the default path that
they will only use for the minute or two they are
running my code.
You might not need to change the users' defaults since you can save the
output directly to any folder path yourself through the code without user
intervention. Steve is not changing the defaults below. He is just finding
the default path because he assumes that is where you wanted the output
saved. But I added some more comments in case you wanted to change the path
the user sees by default.
Then I'm going to need to change the default path back to
whatever it was before they started my code. Can you
suggest how to determine the default path currently set and then change it to
"PathX" and finally reset their default path back to
what it was before after running the code you helped me with?
That's partly what Steve's code is doing.
See comments below.
I hope this is making enough sense.
Thanks in advance,
--
RMC,CPA
Try something like this:
thisDocPath = Options.DefaultFilePath(wdDocumentsPath)
The current place that Word looks for documents is stored in the variable
'thisDocPath' in the line above. You can reset it to "PathX" with:
Options.DefaultFilePath(wdDocumentsPath) = "PathX"
strFileName = UserForm1.TxtClientNmbr
With Dialogs(wdDialogFileSaveAs)
.Name = thisDocPath & "\" & strFileName & ".doc"
You want to use "PathX" above here instead of 'thisDocPath'
Before your macro ends you set things back to the way the user wanted at the
start with:
Options.DefaultFilePath(wdDocumentsPath) = thisDocPathAlso see VBA Help for the ChangeFileOpenDirectory Method which temporarily
changes where the 'file open' or 'file save' dialogs open to while the
current session of the Word application is running. When the user starts up
Word again, Word will be set back to its original defaults automatically
again.