Problem with MailMerge (Excel Macro)

eagl3red

New Member
Joined
Oct 19, 2007
Messages
4
I have a Excel Macro:

Sub MailMergeFromExcel
...
Set W_app = CreateObject("Word.Application")
Set W_doc2 = W_app.Documents.Add
With W_app
Source = "D:\DOCS\EXCEL\data.xls"
W_doc2.Activate
W_doc2.Select
.ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
.ActiveDocument.MailMerge.OpenDataSource Name:=Source _
, ConfirmConversions:=False, ReadOnly:=True, LinkToSource:=False, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="DATOS_CONTRIB", _
SQLStatement:="", SQLStatement1:=""
....
End With
...
End sub

The problem of Excel Macro is in the sentence "...OpenDataSource..." it's very slow, and sometimes show me a Message: "Microsoft Excel is waiting for another application complete an action OLE" (but before Excel try to open PERSONAL.XLS and I click "Read Only").

I try with this code:

W_doc2.MailMerge.OpenDataSource Name:=Source _
, 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=Source;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet" _
, SQLStatement:="SELECT * FROM [Sheet1$]", SQLStatement1:=""

But didn't work

Please, help me.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,190,865
Messages
5,983,289
Members
439,836
Latest member
BuckyBoyRx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top