R
Ridge Kennedy
Dear All,
I have a template that is creating a new document using data from an access
query that is merged into a Word template. All Office 2003 apps on Win2K
and XP pro workstations.
The document is created -- but there is also an additional "Document 1" that
is created every time that has to be deleted -- a copy of the template with
no data in it. If anyone can point out how I can eliminate that extra
clutter, I would appreciate it.
Additionally, my code is messy, since a lot of it was generated by
recording. I'd appreciate gentle recommendations for cleaning it up.
Right now, it says"
Sub autonew()
' Perform Merge using CatalogTextSource.txt
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:= _
"C:\TEMP\MtgNoticeSource.txt", ConfirmConversions:=False, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="",
WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
' Save New Merge Document as NewMeetingNotice.doc
ChangeFileOpenDirectory "C:\My Documents\"
ActiveDocument.SaveAs FileName:="\\cpa_comp\chapters\_chapter
Programs\-Chapter Notice E-Form\__Current\NewMeetingNotice.doc",
FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
Followed by code to clean up and format the document
Thnak you in advance for any assistance.
Sincerely,
Ridge (in New Joisey)
I have a template that is creating a new document using data from an access
query that is merged into a Word template. All Office 2003 apps on Win2K
and XP pro workstations.
The document is created -- but there is also an additional "Document 1" that
is created every time that has to be deleted -- a copy of the template with
no data in it. If anyone can point out how I can eliminate that extra
clutter, I would appreciate it.
Additionally, my code is messy, since a lot of it was generated by
recording. I'd appreciate gentle recommendations for cleaning it up.
Right now, it says"
Sub autonew()
' Perform Merge using CatalogTextSource.txt
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:= _
"C:\TEMP\MtgNoticeSource.txt", ConfirmConversions:=False, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="",
WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
' Save New Merge Document as NewMeetingNotice.doc
ChangeFileOpenDirectory "C:\My Documents\"
ActiveDocument.SaveAs FileName:="\\cpa_comp\chapters\_chapter
Programs\-Chapter Notice E-Form\__Current\NewMeetingNotice.doc",
FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
Followed by code to clean up and format the document
Thnak you in advance for any assistance.
Sincerely,
Ridge (in New Joisey)