Home |
Search |
Today's Posts |
#1
|
|||
|
|||
VBA for Filename Creation without document Save
I have used a macro which creates a filename and saves the document to this
document name. The statement in the macro is currently: ActiveDocument.SaveAs FileName:="blahblahblah" & Format(Order, "00#") I like the way the document is named, but I don't want it saved at this time. How do I update this statement so that the file is named and opened only? Thanks in advance, Barb Reinhardt |
#2
|
|||
|
|||
Barb Reinhardt wrote:
I have used a macro which creates a filename and saves the document to this document name. The statement in the macro is currently: ActiveDocument.SaveAs FileName:="blahblahblah" & Format(Order, "00#") I like the way the document is named, but I don't want it saved at this time. How do I update this statement so that the file is named and opened only? Thanks in advance, Barb Reinhardt Hi Barb, You really can't, because the only time Word actually assigns a file name to a document is during the save process. No save = no name. But you can set things up so that your chosen name is suggested in the Save dialog the first time the document is saved. See http://word.mvps.org/FAQs/MacrosVBA/SetDefFilename.htm. If you know the name you want at the time you create the document, put the code from the article into a macro named AutoNew in the template so it runs right away. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#3
|
|||
|
|||
That does exactly what I want it to do. Thanks.
"Jay Freedman" wrote in message ... Barb Reinhardt wrote: I have used a macro which creates a filename and saves the document to this document name. The statement in the macro is currently: ActiveDocument.SaveAs FileName:="blahblahblah" & Format(Order, "00#") I like the way the document is named, but I don't want it saved at this time. How do I update this statement so that the file is named and opened only? Thanks in advance, Barb Reinhardt Hi Barb, You really can't, because the only time Word actually assigns a file name to a document is during the save process. No save = no name. But you can set things up so that your chosen name is suggested in the Save dialog the first time the document is saved. See http://word.mvps.org/FAQs/MacrosVBA/SetDefFilename.htm. If you know the name you want at the time you create the document, put the code from the article into a macro named AutoNew in the template so it runs right away. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can't save my word document!!! | Microsoft Word Help | |||
"Do you also want to save changes to the document template?" messa | Microsoft Word Help | |||
How do I save a document to a disk? | Microsoft Word Help | |||
I create & save a document then I can only open it in safe mode | Microsoft Word Help | |||
Save a Word Document as PDF??? | Microsoft Word Help |