D
David
Greetings,
I am having a little trouble with a macro I recorded to
complete a mail merge. Normally, I work in Access and am a
little ignorant of Word. Any help here would be great.
Here is the code;
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 12/16/2003 by DBW1
'
ActiveDocument.MailMerge.MainDocumentType =
wdMailingLabels
ActiveDocument.MailMerge.OpenDataSource
Name:="C:\Address-data.doc", _
ConfirmConversions:=False, ReadOnly:=False,
LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="",
WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="",
SQLStatement:="", SQLStatement1 _
:="", SubType:=wdMergeSubTypeOther
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""FirstName"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""LastName"""
Selection.TypeParagraph
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""Address1"""
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""Address1"""
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeParagraph
Selection.TypeBackspace
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""Address1"""
Selection.TypeParagraph
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""City"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""State"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""PostalCode"""
WordBasic.MailMergePropagateLabel
End Sub
The problem seems to be generated from the last
line "WordBasic.MailMergePropagateLabel". I have checked
my references and they look normal. The error states the
command is unavailable.
Any ideas?
Thank you all in advance,
David
I am having a little trouble with a macro I recorded to
complete a mail merge. Normally, I work in Access and am a
little ignorant of Word. Any help here would be great.
Here is the code;
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 12/16/2003 by DBW1
'
ActiveDocument.MailMerge.MainDocumentType =
wdMailingLabels
ActiveDocument.MailMerge.OpenDataSource
Name:="C:\Address-data.doc", _
ConfirmConversions:=False, ReadOnly:=False,
LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="",
WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="",
SQLStatement:="", SQLStatement1 _
:="", SubType:=wdMergeSubTypeOther
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""FirstName"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""LastName"""
Selection.TypeParagraph
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""Address1"""
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""Address1"""
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeParagraph
Selection.TypeBackspace
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""Address1"""
Selection.TypeParagraph
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""City"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""State"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""PostalCode"""
WordBasic.MailMergePropagateLabel
End Sub
The problem seems to be generated from the last
line "WordBasic.MailMergePropagateLabel". I have checked
my references and they look normal. The error states the
command is unavailable.
Any ideas?
Thank you all in advance,
David