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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help - Runtime Error 458

Status
Not open for further replies.

DaddyNackers

Programmer
Oct 4, 2002
16
US
I am getting a run-time error '458' which reads: "Variable uses an automation type not supported in visual basic."

I do not know why i am getting this error...

This is the line of code where it is occuring...
Set WBook = GetObject(WPath, "Excel.Sheet")

I have the following references for this application...
Visual Basic For Applications
Microsoft Access 8.0 Object Library
Microsoft Excel 10.0 Object Library
Microsoft DAO 3.6 Object Library

Any and all help much appreciated - Thanks,
Nackers
 
Are you trying to get a Workbook, or a sheet? Your code suggests a little bit of both ;-)
Rob
[flowerface]
 
This is a bit more of my code.

'open and show Microsoft Excel and the FPG Template file
Segment_Xls = "Fpg" + ".xls"
WPath = "K:\SFS\Nackers\Gunnar_Reports\Templates\" + Segment_Xls
Set WBook = GetObject(WPath, "Excel.Sheet")
WBook.Application.Visible = True
WBook.Application.Windows(Segment_Xls).Visible = True
Set WSheet = WBook.Worksheets("Data")

FYI - this code did work in the past until today. We re-installed Access 97 with a full install today (this is why i am getting this error)
 
Just tried from Word, and yes, it works (no surprise to you, I'm sure). I'm running W2000 & XL2000, though.
Rob
[flowerface]
 
I am running windows NT. Any thoughts on a possible problem?
 
Have you tried to do this just from the VBE immediate window? That would eliminate all kinds of possible interactions. If it doesn't work from within Access, try it from Word. You'll narrow down the source of the problem pretty quickly.
Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top