+ Reply to Thread
Results 1 to 3 of 3

Open Word mail merge file from excel button

  1. #1
    Registered User
    Join Date
    08-21-2013
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    44

    Open Word mail merge file from excel button

    I need a code that will open my mail merge document from excel. I want to be able to click the button and have word automatically open to my mail merge document. My Word document already has the merge fields and labels updated. I just need to open word to make it as user friendly as I can for others who are not as familiar with excel and word. I am very new to VBA; however I can get my Word document to open but it doesn't allow me to use the mail merge features. These features are greyed out and I can't even select the "Finish Merge" tab, nor does the SQL question appear asking that is already linked to my excel sheet. Here is all I got so far:

    Sub Print_Tags()
    Set wordApp = CreateObject("word.Application")

    wordApp.documents.Open "C:\Users\J.Templet\Desktop\LOTO Print Tags\PRINTING TAGS1.docx"

    wordApp.Visible = True

    End Sub

    Please help!!

  2. #2
    Registered User
    Join Date
    08-21-2013
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Open Word mail merge file from excel button

    So I have tried numerous things but I keep getting the same debug issue "Run time Error 424, object needed" I would really appreciate any help with this. Here is the latest on what I have.

    Sub Print_Tags()
    '
    ' Macro1 Macro
    '
    '
    Set wordapp = CreateObject("word.Application")

    wordapp.documents.Open "C:\Users\J.Templet\Desktop\LOTO Print Tags\PRINTING TAGS.dotx"

    wordapp.Visible = True
    docwd.MailMerge.OpenDataSource Name:= _
    "C:\Users\J.Templet\Desktop\LOTO Print Tags\Isolation LOTO Template.xlsx" _
    , ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
    AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
    WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
    Format:=wdOpenFormatAuto, Connection:= _
    "Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source=C:\Users\J.Templet\Desktop\LOTO Print Tags\Isolation LOTO Template.xlsx;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Engine Ty" _
    , SQLStatement:="SELECT * FROM `Tag_List`", SQLStatement1:="", SubType:= _
    wdMergeSubTypeAccess
    docwd.MailMerge.Fields.Add Range:=Selection.Range, Name:="Tag_"
    docwd.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
    "Equip_No"
    docwd.MailMerge.Fields.Add Range:=Selection.Range, Name:="Name"
    docwd.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
    "Date_of_Isolation"
    docwd.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
    "Lock__Tag_No"
    docwd.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
    "Isolation_Type"
    docwd.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
    "Isolation_Location"
    WordBasic.MailMergePropagateLabel
    With docwd.MailMerge
    .Destination = wdSendToNewDocument
    .SuppressBlankLines = True
    With .DataSource
    .FirstRecord = wdDefaultFirstRecord
    .LastRecord = wdDefaultLastRecord
    End With
    .Execute Pause:=False
    End With
    End Sub


    This is the part that is highlighted yellow when I open the debug VBA:

    docwd.MailMerge.OpenDataSource Name:= _
    "C:\Users\J.Templet\Desktop\LOTO Print Tags\Isolation LOTO Template.xlsx" _
    , ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
    AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
    WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
    Format:=wdOpenFormatAuto, Connection:= _
    "Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source=C:\Users\J.Templet\Desktop\LOTO Print Tags\Isolation LOTO Template.xlsx;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Engine Ty" _
    , SQLStatement:="SELECT * FROM `Tag_List`", SQLStatement1:="", SubType:= _
    wdMergeSubTypeAccess

  3. #3
    Registered User
    Join Date
    04-17-2014
    Location
    Tennessee
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Open Word mail merge file from excel button

    Did you get an answer to your question? When in Word did you associate the Excel spreadsheet with the Merge Document?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 01-22-2013, 11:37 AM
  2. [SOLVED] RUN a mail merge (Word file) from a USERFORM in EXCEL
    By alopecito in forum Excel Programming / VBA / Macros
    Replies: 29
    Last Post: 09-18-2012, 09:41 PM
  3. Missing Something - Open Word Mail Merge from Excel but no data source
    By Oz Dude in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-03-2012, 07:25 PM
  4. Mail Merge into Word doc from Excel file not working?
    By danny2000 in forum Word Formatting & General
    Replies: 3
    Last Post: 05-30-2010, 05:19 PM
  5. [SOLVED] Word Mail Merge with Excel as data file
    By HT in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 07-13-2005, 07:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1