Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Sat, 03 May 2008 12:19:19 -0400,    group: microsoft.public.word.vba.beginners        back       


Macro fine in W2000... Breaks in W2002...?   
Howdy,

I recently moved from Office 2000, to Office XP.

I have a bunch of macros that I built (in Word 2000) by
recording, and tweaking, rather than by having any real
understanding of VBA.

They worked fine, but...

Now that I run Word 2002, some of the macros choke.

The one below (with apologies for all the junk my recording
method includes) hangs at the pause that I have marked with
"XXXX", but will not run if I rem that line out. 


'
' NameTagsFirst Macro
' Macro created 5/30/2002 by Kenneth
'
'
    Documents.Add Template:= _
        "F:\Templates\Label 4x2.dot" _
        , NewTemplate:=False, DocumentType:=0
    Documents.Open FileName:="Z:\Data\let.txt",
ConfirmConversions:=False, ReadOnly:= _
        False, AddToRecentFiles:=False,
PasswordDocument:="", PasswordTemplate:= _
        "", Revert:=False, WritePasswordDocument:="",
WritePasswordTemplate:="", _
        Format:=wdOpenFormatAuto
    Selection.TypeText Text:="First" & vbTab
    Selection.TypeParagraph
    ActiveDocument.Save
    ActiveWindow.Close
    Selection.Font.Size = 36
    Selection.Font.Bold = wdToggle
    ActiveDocument.MailMerge.MainDocumentType =
wdFormLetters
    ActiveDocument.MailMerge.OpenDataSource
Name:="Z:\data\let.txt", _
        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:="First"
    Selection.TypeParagraph
   ' ActiveDocument.MailMerge.Fields.Add
Range:=Selection.Range, Name:="Last"
    SendKeys "~"

    ActivePrinter = "OKI"
    
      With ActiveDocument.MailMerge
        .Destination = wdSendToPrinter
        .MailAsAttachment = False
        .MailAddressFieldName = ""
        .MailSubject = ""
        .SuppressBlankLines = True
        With .DataSource
            .FirstRecord = wdDefaultFirstRecord
            .LastRecord = wdDefaultLastRecord
        End With
        .Execute Pause:=True  XXXXXXXXXXXXXXXXXXXXXXX
    End With

ActivePrinter = "Printer Color"

ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Application.ScreenUpdating = True
    Application.Quit


Might you assist in getting this to run properly?

Many thanks,
-- 
Kenneth

If you email... Please remove the "SPAMLESS."
date: Sat, 03 May 2008 12:19:19 -0400   author:   Kenneth

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us