Hi Doug, thanks for the comments. I'm attaching the code for that macro.
Hope this helps!
Sub Labels()
'
' Labels Macro
' Macro recorded 1/11/2006 by LSJ8540
'
ChangeFileOpenDirectory "G:\Headers\"
Documents.Open FileName:="""DISCHARGE LABLES""",
ConfirmConversions:=False _
, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto, Encoding:=1252
Selection.WholeStory
Selection.ConvertToTable Separator:=wdSeparateByCommas, NumColumns:=9, _
NumRows:=127, AutoFitBehavior:=wdAutoFitFixed
With Selection.Tables(1)
.Style = "Table Grid"
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With
Selection.MoveRight Unit:=wdCharacter, Count:=12, Extend:=wdExtend
Selection.InsertRowsAbove 1
Selection.TypeText Text:="dr#"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="drlname"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="drfname"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="adm"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="dis"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="dob"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="plname"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="pfname"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="visit#"
ActiveDocument.SaveAs FileName:="DISCHARGE LABLES.doc", FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
ActiveDocument.Close
Documents.Add DocumentType:=wdNewBlankDocument
ActiveDocument.MailMerge.MainDocumentType = wdMailingLabels
ActiveDocument.MailMerge.OpenDataSource Name:= _
"G:\Headers\DISCHARGE LABLES.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:="""dr"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""drlname"""
Selection.TypeText Text:=", "
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""drfname"""
Selection.TypeParagraph
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""adm"""
Selection.TypeText Text:=" - "
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""dis"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""dob"""
Selection.TypeParagraph
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""plname"""
Selection.TypeText Text:=", "
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""pfname"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldMergeField _
, Text:="""visit"""
WordBasic.MailMergePropagateLabel
End Sub
The error appears after the macro has gone through and one label shows the
placeholders for the data. When I click the Debug option at the error, it
shows this code above and the second line from the bottom is hi-lited yellow.
Thanks for you help!