View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MP[_3_] MP[_3_] is offline
external usenet poster
 
Posts: 19
Default ActiveWorksheet vs Worksheets.Item(1)

Hi
Trying to learn automating excel via vba

Dim oWb as Workbook
Set oWb = oExcelApp.WorkBooks.Add (TEMPLATE_NAME)
'that works

Dim oWs as WorkSheet
Set oWs = oWb.Worksheets.Item(1)
'That works

so the above line is ok but I thought maybe this would be a "better" way
I assumed a new workbook would begin with the first sheet activated???
'Set oWs = oExcelApp.ActiveWorkSheet

'but it throws error (Object doesn't support this property or method)

What is the proper way to get the first sheet in a new workbook?
Thanks
Mark