Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
M M is offline
external usenet poster
 
Posts: 18
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
M M is offline
external usenet poster
 
Posts: 18
Default 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



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
late binding in excel Grey Excel Programming 3 May 22nd 04 05:15 PM
Late Binding Todd Huttenstine[_3_] Excel Programming 3 April 30th 04 11:01 AM
Late Binding Cindy Excel Programming 11 April 23rd 04 03:34 PM
EARLY binding or LATE binding ? jason Excel Programming 6 February 26th 04 04:57 PM
DAO Late Binding? Sharqua Excel Programming 2 January 4th 04 02:05 AM


All times are GMT +1. The time now is 01:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"