count sheets

  • Thread starter Thread starter Frank Dulk
  • Start date Start date
i am guessing you are using this from access if so you have to set up
an application object and what not if you havent done so already

'opens workbook
Dim objexcel As New Excel.Application
Set objexcel = CreateObject("Excel.Application")
objexcel.Workbooks.Open "c:/path of workbook/workbook name.xls"
objexcel.Visible = True
'counts sheets
msgbox objexcel.Sheets.Count

if you are in the wrong group and should be in an excel group use

ActiveWorkbook.Sheets.Count

hope this helps

Regards
Kelvan
 
Back
Top