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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save File Using Field Name

Status
Not open for further replies.

NerdyOne

MIS
Oct 16, 2001
50
US
I have a document template that I created to issue work orders with. The data in the template pulls codes from a separate application using field codes:

(i.e. { QUOTE IncRID \* MERGEFORMAT }

My question is; how do I write a script/macro that uses that field "IncRID" as the filename?

For instance, IncRID (short for Incident ID) = 12345 when the user clicks the toolbar icon or runs the script, it autosaves the file as 12345.doc.

I appreciate any offers, suggestion, advice. Thank you, in advance, for your help!



The Titanic was built by engineers. The Ark was built by an amateur.
 
Have a look at the Fields collection.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Okay, I'm a little dense I guess. Could you elaborate on what you mean by "Look at the Fields collection"?

The Titanic was built by engineers. The Ark was built by an amateur.
 
If IncRID is a number as it looks above:

SaveAs ("c:\" + "somepathname\" & ltrim(str(IncRID))& ".doc")

If IncRID is a string already:

SaveAs ("c:\" + "somepathname\" & IncRID & ".doc")

Put one or other of the lines in a trigger event, 'on_open' I'd guess from your question

John
 
John,

Thank you for your help, you've certainly pointed me in the right direction!

The only problem I've run into is, within the VBA, it says that IncRID=empty. Therefore it saves the file as 0.doc. I'm trying to think of a way around that.

The Titanic was built by engineers. The Ark was built by an amateur.
 
it says that IncRID=empty
I'd use the Option Explicit instruction.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top