save in a specific directory

S

surena

Hi,

I wrote a macro such that I can save a file with a particular name
(name and surname of a person.doc).
Sub savename()
Dim filename As String
filename = ActiveDocument.FormFields("surname").Result + " " +
ActiveDocument.FormFields("name").Result
ActiveDocument.SaveAs filename:=filename

End SubIt works but I want to create this file in a particular folder
like C:/patient. With this macro I create the file and then I must move
it to that folder. How I can improve this macro to include the path
name in it?

Surena
 
M

Martin

It's easier than you think - just put the full path as the filename, e.g.
ActiveDocument.SaveAs "i:\hello.doc"

So your filename line could be:
filename = "C:\patient\" + ActiveDocument.FormFields("surname").Result + " " +
ActiveDocument.FormFields("name").Result

Remember to include the final backslash and make sure it's not a frontslash!
 

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