Link the File name to a bookmark when saving the file

B

bsieloff

I would like to have the file save as one of my bookmarks when I save the
file for the first time. Usually the default is the first several words at
the beginning of the document, but I would like to have it default to one of
the form fields I have the users type in. Is that possible?

Thanks
-B
 
D

Doug Robbins - Word MVP

Use the .Result property of the formfield to get the information that has
been entered into it

With ActiveDocument
.SaveAs .FormFields("formfieldbookmarkname").Result
End With



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
B

bsieloff

Looks like this will do it.... but I'm not sure where this statement needs to
be placed. anywhere on the document? How do I get in the "mode" to enter
the statement, IE. Insert field?

Thanks for you help, and baby stepping me through

-B
 
D

Doug Robbins - Word MVP

It needs to be located in the template from which you are creating the
document.

See the article "What do I do with macros sent to me by other newsgroup
readers to help me out?" at:

http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
B

bsieloff

Ahh.. Macro. Very cool, it works!

One more question... I tried to setup the "SaveAs" fuction as well and did
not find the correct syntax, can you look at this and correct my mistake?
Thanks again

Sub FileSave()
'
' FileSave Macro
' Saves the active document or template
'
With ActiveDocument
.SaveAs .FormFields("Company_Name").Result
End With


End Sub
Sub FileSaveAs()
'
' FileSaveAs Macro
' Saves a copy of the document in a separate file
'
With ActiveDocument
Dialogs .SaveAs.FormFields("Company_Name").Result
End With



End Sub
 
D

Doug Robbins - Word MVP

You want both macros to do the same thing. Therefore, use exactly the same
code in both of them - FileSave() and FileSaveAs

With ActiveDocument
.SaveAs .FormFields("formfieldbookmarkname").Result
End With

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

Graham Mayor

Looking at the OP's macro comment "Saves a copy of the document in a
separate file" I suspect the requirement might be to save a second copy in
another folder. That can be done from the first macro simply by adding the
required paths. There are some examples at
http://www.gmayor.com/automatically_backup.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Top