Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

save in a specific directory

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
surena - 11 Apr 2006 16:35 GMT
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
Martin - 11 Apr 2006 16:56 GMT
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!

> Hi,
>
[quoted text clipped - 12 lines]
>
> Surena
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.