Runtime Error 1004

  • Thread starter Thread starter honey16d
  • Start date Start date
H

honey16d

hi!!

i keep getting this error in vb!!!

worksheetCount = objExcel.Worksheets.Count=== this is my code...

the error i get is Run Time error 1004--- Application Defined Error
or Object Error


Can somebody plz help me out in tis???
 
How is objExcel setup/defined?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
hi!!

i keep getting this error in vb!!!

worksheetCount = objExcel.Worksheets.Count=== this is my code...

the error i get is Run Time error 1004--- Application Defined Error
or Object Error

Can somebody plz help me out in tis???

this is how i hav defined it!!

Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
worksheetCount = objExcel.Worksheets.Count
 
Hi Honey,

'---------------
Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
worksheetCount = objExcel.Worksheets.Count
'---------------

Your problem resides in the fact that you have not
created or opened a workbook.

Information cannot be returned on the number of
worksheets in a non-existant workbook.
 
this is how i hav defined it!!

Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
worksheetCount = objExcel.Worksheets.Count



hey Hi!!

I have declared an excel path from the vb script!!

excelPath = "C:\ExcelFiles\Dimension XML Generation.xls"

Wen i run the macro from the excel sheet i get this error!!

Request you to kindly let me know if there is another way of defining
it
 
this is how i hav defined it!!

Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
worksheetCount = objExcel.Worksheets.Count



Is there any way by which I can set the excel path to the object???
 
It is not the object, but the workbook. Worksheets belongs to a workbook,
but as you haven't opened one, there is no worksheets collection available.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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

Back
Top