J
John Looby
I believe I've asked this question before, and I apologize if you've
responded, but I'm stuck.
What I am trying to do:
I have a number of standard form letters that are bumped up against an
access database to populate the information. Once a mail merge has
been completed, users then do a "merge to new document" and save the
document.
Ideally, I would like the resulting .doc to be automatically saved
with a name that would identify it as emerging from the merge, with a
timedate stamp and the users name. For example, if I use Letter A.doc
for the merge, then merge to a new document, i would like it to be
saved as JLOOBLetterA060404.doc. I can get the date stamp and user
name to transfer over, I just can't get the file name of the source
merge doc.
Here is my (very newbie) code so far:
Sub envelope_postscript()
'
Dim docName As String
strdocname = Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 4)
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.Name = strdocname
.Execute
End With
ActiveDocument.SaveAs FileName:="X:\LETTERS\ENVELOPES\" & docName &
Format(Now(), "yyyymmddhhmmss") & ".doc", FileFormat:= _
wdFormatDocument
ActivePrinter = "Apple LaserWriter 16/600 PS"
Application.PrintOut OutputFileName:="X:\LETTERS\ENVELOPES\" &
docName & Format(Now(), "yyyymmddhhmmss") & ".prn",
Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
Collate:=True, Background:=True, PrintToFile:=False
End Sub
This can't be as hard as I'm making it, and I appreciate any help.
responded, but I'm stuck.
What I am trying to do:
I have a number of standard form letters that are bumped up against an
access database to populate the information. Once a mail merge has
been completed, users then do a "merge to new document" and save the
document.
Ideally, I would like the resulting .doc to be automatically saved
with a name that would identify it as emerging from the merge, with a
timedate stamp and the users name. For example, if I use Letter A.doc
for the merge, then merge to a new document, i would like it to be
saved as JLOOBLetterA060404.doc. I can get the date stamp and user
name to transfer over, I just can't get the file name of the source
merge doc.
Here is my (very newbie) code so far:
Sub envelope_postscript()
'
Dim docName As String
strdocname = Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 4)
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.Name = strdocname
.Execute
End With
ActiveDocument.SaveAs FileName:="X:\LETTERS\ENVELOPES\" & docName &
Format(Now(), "yyyymmddhhmmss") & ".doc", FileFormat:= _
wdFormatDocument
ActivePrinter = "Apple LaserWriter 16/600 PS"
Application.PrintOut OutputFileName:="X:\LETTERS\ENVELOPES\" &
docName & Format(Now(), "yyyymmddhhmmss") & ".prn",
Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
Collate:=True, Background:=True, PrintToFile:=False
End Sub
This can't be as hard as I'm making it, and I appreciate any help.