C
Curt
Have the following macro recorded in word. Problem is when running when it
gets to select entire spread sheet or print area it stops until you make the
selection. I am trying to have the macro make the seclection for entire
spreadsheet. Have set up the ssheet just for this option. Do not know what
part of this code to change to make this happen. Am enclosing the entire
maco
Thanks To All
ChangeFileOpenDirectory "C:\Parade\"
Documents.Open FileName:="LetterHead.doc", ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
Selection.TypeParagraph
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:="C:\Parade\mailEcopy.xls", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="", SQLStatement:="",
SQLStatement1 _
:=""
ActiveDocument.MailMerge.EditMainDocument
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
"Contact_Person"
Selection.TypeParagraph
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
"Address"
Selection.TypeParagraph
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
"CityState"
Selection.TypeParagraph
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:="Zip_"
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=4
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & _
vbTab & vbTab
Selection.InsertDateTime DateTimeFormat:="M/d/yyyy",
InsertAsField:=True, _
DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _
InsertAsFullWidth:=False
Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine, Count:=3
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.TypeParagraph
ActiveDocument.MailMerge.DataSource.QueryString = _
"SELECT * FROM C:\Parade\mailEcopy.xls WHERE ((Contact_Person IS NOT
NULL ))" _
& ""
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = False
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
ActiveWindow.Close
Application.Quit
End Sub
gets to select entire spread sheet or print area it stops until you make the
selection. I am trying to have the macro make the seclection for entire
spreadsheet. Have set up the ssheet just for this option. Do not know what
part of this code to change to make this happen. Am enclosing the entire
maco
Thanks To All
ChangeFileOpenDirectory "C:\Parade\"
Documents.Open FileName:="LetterHead.doc", ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
Selection.TypeParagraph
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:="C:\Parade\mailEcopy.xls", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="", SQLStatement:="",
SQLStatement1 _
:=""
ActiveDocument.MailMerge.EditMainDocument
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
"Contact_Person"
Selection.TypeParagraph
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
"Address"
Selection.TypeParagraph
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
"CityState"
Selection.TypeParagraph
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:="Zip_"
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=4
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & _
vbTab & vbTab
Selection.InsertDateTime DateTimeFormat:="M/d/yyyy",
InsertAsField:=True, _
DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _
InsertAsFullWidth:=False
Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine, Count:=3
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.TypeParagraph
ActiveDocument.MailMerge.DataSource.QueryString = _
"SELECT * FROM C:\Parade\mailEcopy.xls WHERE ((Contact_Person IS NOT
NULL ))" _
& ""
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = False
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
ActiveWindow.Close
Application.Quit
End Sub