My computer at work has Word 97 installed and therefore
have to program in Word 97, but my home computer has
Excel XP (2002) installed. I am trying to open Excel
from Word with the following code but it won't open and
debugs,
Sub Work_On_Excel_File()
Dim oXL As Excel.Application
End sub
Can anyone offer any solutions, please?
Bill
Jonathan West - 29 Feb 2004 21:46 GMT
Hi Bill
Take a look here
Control Excel from Word
http://word.mvps.org/FAQs/InterDev/ControlXLFromWord.htm

Signature
Regards
Jonathan West - Word MVP
http://www.multilinker.com
Please reply to the newsgroup
> My computer at work has Word 97 installed and therefore
> have to program in Word 97, but my home computer has
[quoted text clipped - 11 lines]
>
> Bill
Jezebel - 29 Feb 2004 22:35 GMT
For early binding to work (which is what you are using) you need a project
reference to the Excel library. This is on the Tools > References list in
VBE. The problem you've got here is that to work with Excel 97, you need a
reference to Excel version 8(?) (Excel8.olb); while the XP machine will have
Excel 10+.
If you bring up the References list you should see the Excel reference
listed and marked "MISSING". Clear the missing reference, scroll down to and
select Microsoft Excel object library.
Alternatively, use late binding. This code will also work --
Dim oXL as object
Set oXL = CreateObject("Excel.Application")
That should work on either machine, since it fetches whatever is in the
registry as answering to "Excel.Application".
> My computer at work has Word 97 installed and therefore
> have to program in Word 97, but my home computer has
[quoted text clipped - 11 lines]
>
> Bill