Solved

Find data source in Word 2007 mail merge

Posted on 2014-09-10
5
348 Views
Last Modified: 2014-09-19
EE,
I have a mail merge document in Word 2007 that was setup a few years back.
It grabs the data from an Access database and then creates personalized emails that are sent through Outlook.

I would like to know how to find the data source so that I can do some altering.

Any help would be greatly appreciated.
dresdena1
0
Comment
Question by:dresdena1
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:rlarian
ID: 40315955
if you open the word doc, on the mailings tab you should be able to edit the recipient list.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 40316351
You can try this macro which should cover most types of datasource:
Sub ShowDataSourceDetails()
    Dim strMessage As String
    With ActiveDocument.MailMerge.DataSource
        strMessage = "TableName: " & .TableName
        strMessage = strMessage & vbCrLf & vbCrLf & "Name: " & .Name
        strMessage = strMessage & vbCrLf & vbCrLf & "QueryString: " & .QueryString
        strMessage = strMessage & vbCrLf & vbCrLf & "Connectstring: " & .ConnectString
    End With
    MsgBox strMessage
End Sub

Open in new window

0
 

Author Comment

by:dresdena1
ID: 40324087
Thank you for the prompt responses, sorry to have taken so long to get back to this.

rlarian - I am not interested in editing the recipients of the existing data source. I want to find it, copy it, alter it, and assign it to a new Mail Merge document.

GrahamSkan - My knowledge of the internal workings of Word is very limited, I have the Developer tab active in Word and I see Record Macro, but beyond that I am lost.

Any help would be greatly appreciated.
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 40324815
Here is a slightly tweaked macro;
Sub ShowDataSourceDetails()
    Dim strMessage As String
    With ActiveDocument.MailMerge
        If .MainDocumentType = wdNotAMergeDocument Then
            strMessage = "The active document in not a mail merge document"
        Else
            With .DataSource
                strMessage = "TableName: " & .TableName
                strMessage = strMessage & vbCrLf & vbCrLf & "Name: " & .Name
                strMessage = strMessage & vbCrLf & vbCrLf & "QueryString: " & .QueryString
                strMessage = strMessage & vbCrLf & vbCrLf & "Connectstring: " & .ConnectString
            End With
        End If
    End With
    MsgBox strMessage
End Sub

Open in new window

You can run any macro thus:

Open the VBA editor with Alt+F11.
Select the Normal project in the project explorer pane (upper left).
Insert a Module using the Insert menu.
Select and double-click the new module in the project explorer pane.
Copy and paste the code into the code pane (upper right).
Put the text cursor somewhere in the code and press F5 (run)
0
 

Author Closing Comment

by:dresdena1
ID: 40332259
PERFECT! Thanks very much!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now