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

object required - impossible

Status
Not open for further replies.

incron

Technical User
Mar 16, 2002
60
US
guys look at this code:

ExcelFile = "test.xls"
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.workbooks.open(ExcelFile)


when i run it I get "Object required objExcel" How is that possible I'm declaring the object at the beginning of the code ,any ideas...???
 
Hi bubba10 thanks for the quick reply I changed the code to :


Dim objExcel As Object

ExcelFile = "test.xls"
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.workbooks.open(ExcelFile)

and I keep getting "Expected end of statement" I have tried a comma and : but no luck
 
I don't know anything about VbScript but your code won't open Test.xls. It might open C:\Test.xls. In VBA you need to tell it the path and the file name.
 
Try this, you'll need to run the script in the same directory as test.xls

Dim objExcel

ExcelFile = "test.xls"
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.workbooks.open(ExcelFile)
 
[1] You must have a version of excel application installed on the m/c. Do you have it?
[2] Open the registry and search "Excel.Application". Do you eventually encount some entry like:
[tt] HKEY_CLASSES_ROOT\CLSID\[green]...etc...[/green]/VersionIndependentProgID[/tt]
If yes, look at the path shown in
[tt] HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer[/tt]
Do you have the application there?
[3] If both of above have positive, maybe your m/c is heavily locked down and/or you have not wsh 5.x installed to begin with. In latter case, have you had been successfully running any vbscript at all?
 
Amendment
[2-bis] I meant in the same parent hive, as the part of ...etc... is dependent on the version installed.
[tt] HKEY_CLASSES_ROOT\CLSID\[red]...etc...[/red]\LocalServer[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top