Microsoft Object Library compatibility between 2007 and 2003

erogers

New Member
Joined
Nov 4, 2010
Messages
2
I have a macro in Excel 2007 that interacts with Microsoft Word. I apply the Microsoft Word 12.0 Object Library in order to access the necessary commands. However, when an Office 2003 user tries to use the macro, he gets an error. This is because Office 2003 uses the Microsoft Word 11.0 Object Library. The 12.0 library is seen as missing.

If I save the document in 2003 with the 11.0 Object library, everything works fine. Both 2003 and 2007 users are able to use the macro. But 2007 seems to automatically update the 11.0 object library to 12.0. Thus if a user saves the document in 2007 and tries to pass it back to a 2003 user, the functionality will break once again.

Is there a way to tell VBA to reference 11.0 when using 2003?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
With all MS Office applications it is necessary to create them in the oldest version you want to use.
 
Upvote 0
Right, but that's not the issue. The problem is if an edit is made in Excel 2007 AFTER setting the object library to 11.0 in 2003, it automatically is updated to object library 12.0. How can I keep it set to 11.0 when it goes back to a 2003 instance of Excel?
 
Upvote 0
.... even though you CREATE the workbook in 2003 ?

Can you identify the reason for macro failure ?
A main reason is that although objects have the same name the newer version has additional properties/arguments - which are obviously not recgnised in the older one.
 
Upvote 0
How about not relying on a particular reference or object library?

You can do that with late-binding.

If you can post some code we can probably explain further but here's a small example.
Code:
Dim wrdApp As Object
Dim wrdDoc As Object
 
       Set wrdApp = CreateObject("Word.Application") ' create an instance of Word and a reference to it.
 
       Set wrdDoc = wrdApp.Documents.Open("C:\TheDocument.doc") ' open a word document and create a reference to it 
 
       ' rest of code using wrdApp/wrdDoc to work with Word
 
      wrdDoc.Save
 
      wrdApp.Quit
 
      Set wrdApp = Nothing
PS The Word syntax might be a little off.:)
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

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