PDA

View Full Version : Solved: Changing Filename w/Text Form Field



Humbled
07-14-2008, 01:38 PM
Thanks to those who have unknowingly helped in getting me this far.

I need to change the filename of a document based on what the user enters in a Text Form Field (defined with a bookmark of "PHCY").

Actually, the filename will be ROC-phcy-TIMESTAMP.

Here's the latest iteration of my frustration. Any and all help appreciated. The "ROC-" and timestamp are working OK - I can't get the middle part:
Dim FileName, Store, SvTime As String
'Rename document to ROC-CUST-TIMESTAMP then save it
Store = ActiveDocument.PHCY
SvTime = Format(Now, "yymmdd") & Format(Now, "hhmmss")
FileName = "ROC-" & Store & SvTime
ActiveDocument.SaveAs FileName

macropod
07-14-2008, 02:55 PM
Hi Humbled,

Try:
store = ActiveDocument.Bookmarks("PHCY").Range.Text

Humbled
07-14-2008, 03:08 PM
:bow: Many thanks! That did the trick.