How do I make this macro add text in front...

D

Dbltap

I was given this great macro to create the file name based off of a specific
field in a form but how would I modify it to add a set name in front of the
form info?

Here is the macro:

Dim fname as string
fname = ActiveDocument.Formfields("filenameformfieldname").Result
ActiveDocument.SaveAs fname

Right now the field is a number i.e. 4856, and I would like it to have it
save as “P&D Report 4856.docâ€

What would I add?

Thanks, this forum is great!

Chris
 
G

Greg

Chris,

Something like:

Dim fname As String
Dim fVar As String

fVar = ActiveDocument.FormFields("filenameformfield").Result
fname = "Whatever you like " & fVar
ActiveDocument.SaveAs fname
 
D

Dbltap

Thanks Greg! Just what I needed. One of these day's I'll get the hang of it
but right now macros's are all french to me :)
 
Top