View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Runtime Error 1004

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.


---
Regards,
Norman


wrote in message
oups.com...
On Apr 13, 12:35 pm, wrote:
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