Use late binding.
Instead of declaring your Word object as Word,Application, declare it as a
generic object
Dim wordApp as object
and then don't New, createobject
Set wordApp = CreateObject(,"Word.Application")
then use the object as before.
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Ed" wrote in message
...
I have an Excel project which calls Word (hence posting to both NG). It's
created on a system running Windows/Office XP. I've been having
difficulty
running code which calls Word on Windows/Office 2000 machines. I
discovered
the reference to the Word library was for Word10 - XP - which does not
exist
on a 2000 machine. I got the bright idea of copying the Word9 reference
from a 2000 machine onto my XP machine, and then setting the reference in
the code which creates this workbook. With the following code, I have two
problems:
Sub Change_Refs()
' Set reference to Word9 vs. Word10
refWord9 = "C:\Program Files\Microsoft Office\Office10\MSWORD9.olb"
refWord10 = "C:\Program Files\Microsoft Office\Office10\MSWORD.olb"
ThisWorkbook.VBProject.References.Remove refWord10
ThisWorkbook.VBProject.References.AddFromFile refWord9
End Sub
Problem 1: The Remove line generates an error - "Object required"
Problem 2: I commented out the Remove line just to see what the code
would
do on the Add line. Another error - I'm not trusted to programmatically
change the VB project.
Any suggestions?
Ed