How do I save a file using the value entered in a text form field

S

ScoJO

I have a word document that myself and others on my team must fill out
repeatly. I created a simple template for the basic form to automate the
process, I would like to automate the "Save As" file name using date from one
of the "Text form Fields". the file name would be
"SW_COA_XXXXXX_johnson.doc". The XXXXXX would be the numeric value entered in
Text Form Field labeled "Text 2". Can this be done?

Scott
 
D

Doug Robbins - Word MVP

With ActiveDocument
.SaveAs "SW_COA_" & .Formfields("Text2").Result & "_johnson.doc"
End With

I suggest that you give a more meaninful name to the bookmarks assigned to
your formfields.

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

Geoff

Doug Robbins - Word MVP said:
With ActiveDocument
.SaveAs "SW_COA_" & .Formfields("Text2").Result & "_johnson.doc"
End With

I tried to do this with a module within a template, but I get an error
telling me "the requested member of the collection does not exist".

If I go to the locals window, ActiveDocument isn't even there. Sorry, my
VisualBasic is a lot stronger within Access. But if I am running the code
from an open template with data, how can there not be an active document?
 

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