• Need to create a Macro in Word 2003

    Author
    Topic
    #461261

    Here is what I did. I don’t know anything about V-Basic

    1. Selected Tools | Macro | Record New Macro…
    2. Record Macro dialog box, in Macro name section (entered name PLS | Selected Assign to macro icon Toolbars
    3. Customized dialog box, In commands tab, commands section, dragged icon to my toolbar (selected new button icon etc.)
    4. Selected Close
    5. Macro starts recording (cursor looks like a tape)

    I then wanted to do the followings steps for my macro:

    1. Select from Menu Bar Tools | Letters and Mailings | Mail Merge Wizard…
    2. In Select document type section, select Letters (radio button)
    3. In Step 1 of 6 section, select Next: Starting document
    4. In Select starting document section, select Use the current document (radio button)
    5. In Step 2 of 6 section, select Next: Select recipients
    6. In Select starting document section, select Select recipients section, select Use an existing list (radio button)
    7. In Step 3 of 6 section, select Next: Write your letter
    8. In Select Data Source dialog box, select Desktop, select Black Book, Excel file
    9. Select Open
    10. In Select Table dialog box, select OK (There is only one worksheet)
    11. Mail Merge Recipients dialog box opens, select clear all – Note: There is where I want my Macro to end. The rest of the steps would be done manually.

    The bottom line (I select the ion off my toolbar, nothing happens. Below is the code the computer created for me automatically. I do not know V-Basic. HELP!!

    Sub PLS()

    ‘ PLS Macro
    ‘ Macro recorded 7/16/2009 by User

    ActiveDocument.MailMerge.OpenDataSource Name:= _
    “C:Documents and SettingsUserDesktopBlack Book.xls”, _
    ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
    AddToRecentFiles:=False, PasswordDocument:=””, PasswordTemplate:=””, _
    WritePasswordDocument:=””, WritePasswordTemplate:=””, Revert:=False, _
    Format:=wdOpenFormatAuto, Connection:= _
    “Provider=Microsoft.Jet.OLEDB.4.0;Password=””””;User ID=Admin;Data Source=C:Documents and SettingsUserDesktopBlack Book.xls;Mode=Read;Extended Properties=””HDR=YES;IMEX=1;””;Jet OLEDB:System database=””””;Jet OLEDB:Registry Path=””””;Jet OLEDB:Database Passwor” _
    , SQLStatement:=”SELECT * FROM `’Black Book$’`”, SQLStatement1:=””, _
    SubType:=wdMergeSubTypeAccess
    End Sub

    Viewing 0 reply threads
    Author
    Replies
    • #1169458
      Code:
      Sub PLS()
      '
      ' PLS Macro
      ' Macro recorded 7/16/2009 by User
      '
      	ActiveDocument.MailMerge.OpenDataSource Name:= _
      		"C:Documents and SettingsUserDesktopBlack Book.xls", _
      		ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
      		AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
      		WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
      		Format:=wdOpenFormatAuto, Connection:= _
      		"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:Documents and SettingsUserDesktopBlack Book.xls;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Passwor" _
      		, SQLStatement:="SELECT * FROM `'Black Book$'`", SQLStatement1:="", _
      		SubType:=wdMergeSubTypeAccess
      End Sub

      It looks as though one step was recorded: OpenDataSource. If you highlight that word and press F1, you should get the help screen describing the parameters that follow. Some, such as Name, are obvious. Others perhaps are better ignored.

      I don’t do merges, so I don’t know what is “missing” at this point. What happens when you run the above macro?

      • #1169790

        It looks as though one step was recorded: OpenDataSource. If you highlight that word and press F1, you should get the help screen describing the parameters that follow. Some, such as Name, are obvious. Others perhaps are better ignored.

        I don’t do merges, so I don’t know what is “missing” at this point. What happens when you run the above macro?

        Nothing. I select the icon and nothing happens!!

    Viewing 0 reply threads
    Reply To: Need to create a Macro in Word 2003

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: