![]() |
Count Worksheets - Late Binding
Using the code:
Dim oApp as Object intCount as Integer Set oApp = CreateObject("Excel.Application") oApp.Workbooks.Open("C:\Test.xls") to open a .xls with late binding, what would I use to count the worksheets? And I'm having to use late binding to avoid reference issues and cannot use early binding. (Thanks to our IT Dept.) Thanks M |
Count Worksheets - Late Binding
Hi
not tested but try Dim oApp as Object Dim wbk intCount as Integer Set oApp = CreateObject("Excel.Application") set wbk = oApp.Workbooks.Open("C:\Test.xls") intcount = wbk.worksheets.count -- Regards Frank Kabel Frankfurt, Germany "M" schrieb im Newsbeitrag ... Using the code: Dim oApp as Object intCount as Integer Set oApp = CreateObject("Excel.Application") oApp.Workbooks.Open("C:\Test.xls") to open a .xls with late binding, what would I use to count the worksheets? And I'm having to use late binding to avoid reference issues and cannot use early binding. (Thanks to our IT Dept.) Thanks M |
Count Worksheets - Late Binding
Dim oApp as Object
Dim oWb as Object intCount as Integer Set oApp = CreateObject("Excel.Application") Set oWb = oApp.Workbooks.Open("C:\Test.xls") intCount = oWb.Woksheets.Count -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "M" wrote in message ... Using the code: Dim oApp as Object intCount as Integer Set oApp = CreateObject("Excel.Application") oApp.Workbooks.Open("C:\Test.xls") to open a .xls with late binding, what would I use to count the worksheets? And I'm having to use late binding to avoid reference issues and cannot use early binding. (Thanks to our IT Dept.) Thanks M |
Count Worksheets - Late Binding
Cookin' with gas! Thanks guys!
M -----Original Message----- Dim oApp as Object Dim oWb as Object intCount as Integer Set oApp = CreateObject("Excel.Application") Set oWb = oApp.Workbooks.Open("C:\Test.xls") intCount = oWb.Woksheets.Count -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "M" wrote in message ... Using the code: Dim oApp as Object intCount as Integer Set oApp = CreateObject("Excel.Application") oApp.Workbooks.Open("C:\Test.xls") to open a .xls with late binding, what would I use to count the worksheets? And I'm having to use late binding to avoid reference issues and cannot use early binding. (Thanks to our IT Dept.) Thanks M . |
Count Worksheets - Late Binding
Please! wbk should be declared as an object, not variant<vbg
Bob "Frank Kabel" wrote in message ... Hi not tested but try Dim oApp as Object Dim wbk intCount as Integer Set oApp = CreateObject("Excel.Application") set wbk = oApp.Workbooks.Open("C:\Test.xls") intcount = wbk.worksheets.count -- Regards Frank Kabel Frankfurt, Germany "M" schrieb im Newsbeitrag ... Using the code: Dim oApp as Object intCount as Integer Set oApp = CreateObject("Excel.Application") oApp.Workbooks.Open("C:\Test.xls") to open a .xls with late binding, what would I use to count the worksheets? And I'm having to use late binding to avoid reference issues and cannot use early binding. (Thanks to our IT Dept.) Thanks M |
Count Worksheets - Late Binding
Bob
of course correct, somehow forgot that.... -- Regards Frank Kabel Frankfurt, Germany "Bob Phillips" schrieb im Newsbeitrag ... Please! wbk should be declared as an object, not variant<vbg Bob "Frank Kabel" wrote in message ... Hi not tested but try Dim oApp as Object Dim wbk intCount as Integer Set oApp = CreateObject("Excel.Application") set wbk = oApp.Workbooks.Open("C:\Test.xls") intcount = wbk.worksheets.count -- Regards Frank Kabel Frankfurt, Germany "M" schrieb im Newsbeitrag ... Using the code: Dim oApp as Object intCount as Integer Set oApp = CreateObject("Excel.Application") oApp.Workbooks.Open("C:\Test.xls") to open a .xls with late binding, what would I use to count the worksheets? And I'm having to use late binding to avoid reference issues and cannot use early binding. (Thanks to our IT Dept.) Thanks M |
Count Worksheets - Late Binding
Object variables are stored as 32-bit (4-byte) addresses that refer to
objects. Using the Set statement, a variable declared as an Object can have any object reference assigned to it. Variant 16 bytes a few more bytes and a little slower, hardly anything to get emotional about. Especially for the problem cited. -- Regards, Tom Ogilvy "Frank Kabel" wrote in message ... Bob of course correct, somehow forgot that.... -- Regards Frank Kabel Frankfurt, Germany "Bob Phillips" schrieb im Newsbeitrag ... Please! wbk should be declared as an object, not variant<vbg Bob "Frank Kabel" wrote in message ... Hi not tested but try Dim oApp as Object Dim wbk intCount as Integer Set oApp = CreateObject("Excel.Application") set wbk = oApp.Workbooks.Open("C:\Test.xls") intcount = wbk.worksheets.count -- Regards Frank Kabel Frankfurt, Germany "M" schrieb im Newsbeitrag ... Using the code: Dim oApp as Object intCount as Integer Set oApp = CreateObject("Excel.Application") oApp.Workbooks.Open("C:\Test.xls") to open a .xls with late binding, what would I use to count the worksheets? And I'm having to use late binding to avoid reference issues and cannot use early binding. (Thanks to our IT Dept.) Thanks M |
All times are GMT +1. The time now is 10:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com