Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel9.olb problem

Status
Not open for further replies.

VBmim

Programmer
Jun 25, 2001
361
BE
I want to open excel from visual basic form with the following code:

Dim excApp As Excel.Application
Set excApp = New Excel.Application
excApp.Visible = True
excApp.SheetsInNewWorkbook = 1
excApp.Workbooks.Add

I get the following error message: Variable uses an Automation Type not supported in Visual Basic

The file excel9.olb is checked in the project's references.

Can anyone help me?

tnx in advance

Mim
 
Hi,

I ran this code with excel8.olb. No problems. You're sure the fault is in this piece of code? And what line? You can step through the code and see which statement generates the error.

Herman :-Q
 
I drop "early binding" for production to avoid down-level Office version problems.
Code:
#Constant blnEarly = True  ' Use Intellisense
#if blnEarly then
    Dim excApp As Excel.Application
#else
    Dim excApp As Object
#End if
Set excApp = CreateObject("Excel.Application")
 
Yep, this works!!
I found out that the excel8.olb was replaced with excel9.olb when I ran a patch for Visual Basic.
The only problem is that I don't use excel 2000 yet (excel9.olb is for excell 2000).
Never trust patches...

Mim ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top