View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Runtime Error 1004

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)

wrote in message
ups.com...
On Apr 13, 1:51 pm, wrote:
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




Is there any way by which I can set the excel path to the object???