#1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Curt Curt is offline
external usenet poster
 
Posts: 32
Default macro stops

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




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ink stops as soon as I lift the pen Jonathan Microsoft Word Help 0 September 25th 06 09:40 AM
sound stops dz New Users 1 December 8th 05 09:42 PM
Tab Stops RedChequer New Users 2 September 25th 05 05:29 AM
TOC -- wrong tab stops Nitzan Shaked Page Layout 2 April 25th 05 07:30 AM
Text Box vs. Tab Stops Barb R. Microsoft Word Help 4 March 24th 05 10:10 PM


All times are GMT +1. The time now is 02:31 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"