Object Library feature not supported

B

Barb Reinhardt

I'm using this code out of Outlook
Dim XLApp as Excel.Application

Set XLApp = CreateObject("Excel.Application")

And it's worked before, but today I'm getting the following error:

Compile Error
Object library feature not supported

I have chosen the Microsoft Excel 12.0 Object Library in the References
within the VBE. Does anyone have any idea why this might not work.

Thanks,
Barb Reinhardt
 
P

Peter T

Try,

Dim XLApp as Object ' Excel.Application
Set XLApp = CreateObject("Excel.Application")

If that works, do you have any other version of Excel installed

Regards,
Peter T
 
B

Barb Reinhardt

It worked once I changed all of the
Dim abc as Excel.Something to
Dim abc as Object

It used to work. Any idea why I had to change it to late binding?

Thanks,
Barb Reinhardt
 
B

Barb Reinhardt

I have a folder for Office11 on my machine, but don't see any application for
that version. This may have started when I moved to a new machine that has
Excel 2007 on it.

Thanks for your assistance.
Barb Reinhardt
 
P

Peter T

It all sounds rather strange

Start a new project, say in a Word doc. Add the reference to Excel 2007,
write a simple routine that refers to Excel, eg

Sub test()
Dim xlApp as Excel.Application
Dim rng As Excel.Range
dim ws as Excel.Worksheet
dim wb as Excel.workbook

set xlApp = CreateObject("excel.application")
xlApp.visible = true
set wb = xlApp.workbooks.add
set ws = xlApp.ActiveSheet
set rng = xlApp.ActiveCell
wb.close fale
xlapp.quit
end sub

might be a typo or two!

Compile the project and try the test routine

Regards,
Peter T
 
P

Peter T

OK, in the code that doesn't compile do you see anything relating to the
Excel object model that was introduced in '2007.

Regards,
Peter T
 
B

Barb Reinhardt

I deselected an Office 11.0 reference (and now I can't find it again) and
everything ran fine. I don't know why the reference was selected in the
first place. Thanks again for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top