Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a form field to enter the Save As filename

Status
Not open for further replies.

funkmonsteruk

IS-IT--Management
Feb 8, 2002
210
GB
I have a questionnaire that i am currently circulating around my office. I would like the user to enter their name into a form field on the questionnaire and once the form is saved i would like Word to name the document after this Form Field.

The form field is called Name1, the folder in which io would like the documents to be saved is F:/Public/IT/Smyth/Response to questionnaire. I'm quite new to VBA programming so any help would be grately appreciated.
 
The following code should do the trick:
Code:
'define a variable to store name
Dim fName as String
'put name in variable
fName = Name1.Text
'save document using fixed path, name variable and extension
ActiveDocument.SaveAs _
  FileName:="F:/Public/IT/Smyth/Response to questionnaire/" _
  & fName & ".doc"
I hope this helps, SteveB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top