Excel 2007 and Word 2007 Mail Merge Connection Problem when opening datasource as Read Only

cvincent

Board Regular
Joined
Aug 28, 2011
Messages
66
If someone has a solution to this problem, I would be very grateful!! I'm no expert in VBA, so any help you can provide would be most helpful.

I have my data in Excel 2007, protected by a password to open file, and read only password. I have a form in Word 2007.

The user opens the Excel file first, selects the data, then clicks a macro that is set to open the Word document, and upon Open runs the Word macro to merge the selected data into the form. It works fine as long as I do NOT open the Excel file as "read only", i.e. I must enter both passwords to make it work. I need users to open the Excel file as a "Read Only".

If I open the Excel file as a "read only", however, the Word macro will not run. It is getting hung up on the connection.

I am getting the following error message: "Error has occurred: External table is not in the specified format"

Following is the part of the macro that is causing the problem:

ActiveDocument.MailMerge.OpenDataSource Name:= _
"F:\EMERGENCY CONTACTS\DATABASE-EMERGENCY CONTACTS (rev 6-2013).xlsm" _
, ConfirmConversions:=False, ReadOnly:=True, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="XYZ", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:= _
"Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source=F:\EMERGENCY CONTACTS\DATABASE-EMERGENCY CONTACTS (rev 6-2013).xlsm;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB" _
, SQLStatement:="SELECT * FROM `'Selected Contacts$'`", SQLStatement1:="" _
, SubType:=wdMergeSubTypeAccess


Thank you!!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

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
Back
Top