I have an old vb6 app that I'm in charge of maintaining that saves, opens, and prints Word documents to a users computer. The other day when we switched from office 2003 to office 2010, I started to get complaints that the software would no longer open saved reports and print them. Removing Officer 2010 and installing 2003 fixes the problem.
The sub procedure that handles this is all vanilla msdn code and I'm unable to find anything that would tie it to a certain version of Word. My next thought is perhaps its the OLE dll reference. Where/how can I update the VB6 reference to the dll to work with the new version of office?
Any other suggestions would be greatly appreciated.
I'm not sure but as a guess it sounds like you are trying to use early binding. If so this is likely your problem.
There are numerous MS KB articles warning about this over a period of over a decade. Examples:
http://support.microsoft.com/kb/247579
http://support.microsoft.com/kb/245115
In other words: remove all references to any version of Word, declare all of the objects As Object
, and use CreateObject()
or GetObject()
where appropriate instead of Set Obj = New LibName.ClassName
.
These KB articles are old now, and the old rules that let you get away with compiling with a reference to Word 95 and still automate Word 2002 don't seem to apply anymore. Besides needing the oldest supported version of Office installed on your dev machine, I suspect upward compatibility was broken beginning in Office 2003.
Your best bet is late binding. The performance penalty is minimal for most programs so the biggest headache is losing IntelliSense.