Setting Path in FileSaveAs Dialog

N

NZ VBA Developer

Very quick question: Is there any way to set the path in for the FileSaveAs
dialog when calling it in code?

The reason I ask is because I'm trying to save a newly created template
programmatically (see my previous post) but Word wants to save it in my User
Templates location. I want it to go in the same location as the master
template that's used to create the new template in the first place. However,
I can't seem to convince Word to used a different path.

Maybe if I temporarily changed the User Templates location first...?

Cheers!
 
N

NZ VBA Developer

Jay,

That was my plan originally - use the path of the master template in the
Name argument for the FileSaveAs dialog - but Word seems to have a mind of
its own: If it's a template, then by God it's going into the User Templates
folder!

My first attempt

With Dialogs(wdDialogFileSaveAs)
.Name = [MASTERPATH] & [FILENAME]
.Show
End With

just concatenated the short path and the value I specified for the file
name: something like "[MASTERPATH][FILENAME]"; the location was still User
Templates. So I stuck a backslash between the two (.Name = [MASTERPATH] & "\"
& [FILENAME]). That just got me the file name; the path still didn't change.
And just to be sure I popped a message box to verify the path to the master
template, but still no joy.

~sigh~

Looks like I'll have to muck around with temporarily changing the User
Templates location, saving the template and then setting it back again.

Cheers!
 
N

NZ VBA Developer

OH FOR F...!!!

Never mind, Jay. I'm sure the info in the MVP article would work - IF WORD
WASN'T LOCKED DOWN SO I CAN'T CHANGE THE BLOODY USER TEMPLATES PATH!!!

My first clue was when I tried to do it manually (and record it). Everything
looked fine; code was just exactly what I expected; but the path still didn't
change. I even tried it twice just to be sure.

The joys of contracting to a large corporation...

Cheers!
 

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