macros in forms

S

Stormy Weather

I want to make a macro that will save a template using the information filled
in on one of the entries as the file name. I cannot make the macro pick up
the blank field in the template / form. Any ideas?
 
D

Doug Robbins - Word MVP

If you are using FormFields, you can get the data that is entered into a
FormField by using

ActiveDocument.FormFields("bookmarkname:).Result

--
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
 
S

Stormy Weather

It is helpful, but I'm still not sure how to apply it. It opened up the
world of writing macros to me, though!
Here is how the macro looks with your suggestion:

Sub SaveAsDrawingNumber()
'
' SaveAsDrawingNumber Macro
'
'
ChangeFileOpenDirectory _
"E:\ELJD\Pending\"
ActiveDocument.SaveAs FileName:= _
"E:\ELJD\Pending\ActiveDocument.FormFields.Text13.Result.doc", _
FileFormat:=wdFormatDocument, LockComments:=False, Password:="", _
AddToRecentFiles:=True, WritePassword:="",
ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False,
SaveFormsData _
:=False, SaveAsAOCELetter:=False
End Sub

Of course it saves it to the right place, but the file name is always
ActiveDocument.FormFields.Text13.Result.doc

Can you provide further assistance? By the way, the properties describes
the field I would like to use as the document title as a "bookmark."
 
D

Doug Robbins - Word MVP

Change

ActiveDocument.SaveAs FileName:= _
"E:\ELJD\Pending\ActiveDocument.FormFields.Text13.Result.doc",

To

ActiveDocument.SaveAs FileName:= _
"E:\ELJD\Pending\" & ActiveDocument.FormFields.Text13.Result &
".doc",

--
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
 

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