Excel Object Library Backward Compatibility Issue

PaulJardine asked on

I have a Word 2003 document containing VBA code that references the Microsoft Excel 11.0 Object Library.

This document will also happily run its VBA code under Word 2007 on a different PC (by automatically replacing this reference with one to the Excel 12.0 Object Library - and all the other prior references to other Office 2003 product libraries).

However, if this Word 2003 document's VBA is amended under then Word 2007 environment then the replacement Excel 12.0 Object Library becomes automatically andpermanently referenced.  Now if this document is now opened again in a Word 2003 environment the VBA code will not run and there is an error message "Compile error: Can't find project or library".

Is there a way to overcome this apparent  backward compatibility issue?

4 people had this question

Abuse history

The answered status icon Answer
HansV MVP replied on

You have to change the offending line to

Set oXL = CreateObject("Excel.Application")

Kind regards, HansV
Be the first person to mark this helpful

Abuse history