Saving document in the appropriate place

G

Guest

I have a macro that redefines the "SaveAs" command so that the document is
saved as the contents of a formfield in the document plus the date of the
document. I also have a command to save the document in a particular place,
i. e., myPath = "C:\Bay Area Mobile\". However the document does NOT save to
that folder and instead saves to the folder listed under Tools, Options, File
Locations. I find I have to change the file under Tools, Options, File
Locations in order to get the document to save in the right place. How can I
save the document in the place I specifiy?
 
J

Jezebel

Dim pFileName as string

pFileName = myPath & [formfield] & format$(Now, "yyyymmdd")
ActiveDocument.SaveAs FileName:=pFileName
 
G

Guest

The third line gives me an error saying that this is not a valid file name

Dim pFileName As String

myPath = "C:\"

ActiveDocument.SaveAs FileName:=pFileName

Jezebel said:
Dim pFileName as string

pFileName = myPath & [formfield] & format$(Now, "yyyymmdd")
ActiveDocument.SaveAs FileName:=pFileName




AMG said:
I have a macro that redefines the "SaveAs" command so that the document is
saved as the contents of a formfield in the document plus the date of the
document. I also have a command to save the document in a particular
place,
i. e., myPath = "C:\Bay Area Mobile\". However the document does NOT save
to
that folder and instead saves to the folder listed under Tools, Options,
File
Locations. I find I have to change the file under Tools, Options, File
Locations in order to get the document to save in the right place. How
can I
save the document in the place I specifiy?
 
J

Jezebel

Of course it does. You have to set the value of pFileName before you use it.





AMG said:
The third line gives me an error saying that this is not a valid file name

Dim pFileName As String

myPath = "C:\"

ActiveDocument.SaveAs FileName:=pFileName

Jezebel said:
Dim pFileName as string

pFileName = myPath & [formfield] & format$(Now, "yyyymmdd")
ActiveDocument.SaveAs FileName:=pFileName




AMG said:
I have a macro that redefines the "SaveAs" command so that the document
is
saved as the contents of a formfield in the document plus the date of
the
document. I also have a command to save the document in a particular
place,
i. e., myPath = "C:\Bay Area Mobile\". However the document does NOT
save
to
that folder and instead saves to the folder listed under Tools,
Options,
File
Locations. I find I have to change the file under Tools, Options, File
Locations in order to get the document to save in the right place. How
can I
save the document in the place I specifiy?
 
G

Guest

Sorry, but I don't know how to write in Visual Basic very well.

I want to save the document in the folder C:\Documents and
Settings\Gwinnett Clinic\My Documents\Bay Area Mobile

How would I write that?

Jezebel said:
Of course it does. You have to set the value of pFileName before you use it.





AMG said:
The third line gives me an error saying that this is not a valid file name

Dim pFileName As String

myPath = "C:\"

ActiveDocument.SaveAs FileName:=pFileName

Jezebel said:
Dim pFileName as string

pFileName = myPath & [formfield] & format$(Now, "yyyymmdd")
ActiveDocument.SaveAs FileName:=pFileName




I have a macro that redefines the "SaveAs" command so that the document
is
saved as the contents of a formfield in the document plus the date of
the
document. I also have a command to save the document in a particular
place,
i. e., myPath = "C:\Bay Area Mobile\". However the document does NOT
save
to
that folder and instead saves to the folder listed under Tools,
Options,
File
Locations. I find I have to change the file under Tools, Options, File
Locations in order to get the document to save in the right place. How
can I
save the document in the place I specifiy?
 
J

Jezebel

Follow the instructions I gave you.



AMG said:
Sorry, but I don't know how to write in Visual Basic very well.

I want to save the document in the folder C:\Documents and
Settings\Gwinnett Clinic\My Documents\Bay Area Mobile

How would I write that?

Jezebel said:
Of course it does. You have to set the value of pFileName before you use
it.





AMG said:
The third line gives me an error saying that this is not a valid file
name

Dim pFileName As String

myPath = "C:\"

ActiveDocument.SaveAs FileName:=pFileName

:

Dim pFileName as string

pFileName = myPath & [formfield] & format$(Now, "yyyymmdd")
ActiveDocument.SaveAs FileName:=pFileName




I have a macro that redefines the "SaveAs" command so that the
document
is
saved as the contents of a formfield in the document plus the date
of
the
document. I also have a command to save the document in a
particular
place,
i. e., myPath = "C:\Bay Area Mobile\". However the document does
NOT
save
to
that folder and instead saves to the folder listed under Tools,
Options,
File
Locations. I find I have to change the file under Tools, Options,
File
Locations in order to get the document to save in the right place.
How
can I
save the document in the place I specifiy?
 
G

Guest

This is my macro and I continue to get an error message since it doesn't want
to recognize my form field:

Sub FileSaveAsAgave()
'
' FileSaveAs Macro
'
Dim pFileName As String
myPath = "C:\"
pFileName = myPath & Format$(Now, "yyyymmdd") & [Text1] & [Text2] & [Text7]
ActiveDocument.SaveAs FileName:=pFileName
Dialogs(wdDialogFileSaveAs).Show
End Sub

I simply used text1, text2, text3, etc to label the form fields.

Jezebel said:
Follow the instructions I gave you.



AMG said:
Sorry, but I don't know how to write in Visual Basic very well.

I want to save the document in the folder C:\Documents and
Settings\Gwinnett Clinic\My Documents\Bay Area Mobile

How would I write that?

Jezebel said:
Of course it does. You have to set the value of pFileName before you use
it.





The third line gives me an error saying that this is not a valid file
name

Dim pFileName As String

myPath = "C:\"

ActiveDocument.SaveAs FileName:=pFileName

:

Dim pFileName as string

pFileName = myPath & [formfield] & format$(Now, "yyyymmdd")
ActiveDocument.SaveAs FileName:=pFileName




I have a macro that redefines the "SaveAs" command so that the
document
is
saved as the contents of a formfield in the document plus the date
of
the
document. I also have a command to save the document in a
particular
place,
i. e., myPath = "C:\Bay Area Mobile\". However the document does
NOT
save
to
that folder and instead saves to the folder listed under Tools,
Options,
File
Locations. I find I have to change the file under Tools, Options,
File
Locations in order to get the document to save in the right place.
How
can I
save the document in the place I specifiy?
 
J

Jezebel

You need to *retrieve* the contents of your formfields. Have you ever looked
at Help?

ActiveDocument.FormFields("Text1").Result, etc

You might want to use more meaningful names, too.




AMG said:
This is my macro and I continue to get an error message since it doesn't
want
to recognize my form field:

Sub FileSaveAsAgave()
'
' FileSaveAs Macro
'
Dim pFileName As String
myPath = "C:\"
pFileName = myPath & Format$(Now, "yyyymmdd") & [Text1] & [Text2] &
[Text7]
ActiveDocument.SaveAs FileName:=pFileName
Dialogs(wdDialogFileSaveAs).Show
End Sub

I simply used text1, text2, text3, etc to label the form fields.

Jezebel said:
Follow the instructions I gave you.



AMG said:
Sorry, but I don't know how to write in Visual Basic very well.

I want to save the document in the folder C:\Documents and
Settings\Gwinnett Clinic\My Documents\Bay Area Mobile

How would I write that?

:

Of course it does. You have to set the value of pFileName before you
use
it.





The third line gives me an error saying that this is not a valid
file
name

Dim pFileName As String

myPath = "C:\"

ActiveDocument.SaveAs FileName:=pFileName

:

Dim pFileName as string

pFileName = myPath & [formfield] & format$(Now, "yyyymmdd")
ActiveDocument.SaveAs FileName:=pFileName




I have a macro that redefines the "SaveAs" command so that the
document
is
saved as the contents of a formfield in the document plus the
date
of
the
document. I also have a command to save the document in a
particular
place,
i. e., myPath = "C:\Bay Area Mobile\". However the document does
NOT
save
to
that folder and instead saves to the folder listed under Tools,
Options,
File
Locations. I find I have to change the file under Tools,
Options,
File
Locations in order to get the document to save in the right
place.
How
can I
save the document in the place I specifiy?
 

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