LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.interopoledde,microsoft.public.excel.programming,microsoft.public.excel.sdk
external usenet poster
 
Posts: 9
Default Retrieving list of worksheets programmatically

Hi,

Sorry if this is a FAQ. I did search a number of Excel newsgroups and
Google hits before posting.

Say I have an Excel spreadsheet C:\Temp\My_Worksheet.xls, and it contains
the worksheets "Foo", "Bar", and "Foo Bar". Is there a simple script I can
write that will retrieve the names of the worksheets?

Something like:

VB:
wscript GetWorksheetNames.vbs "C:\Temp\My_Worksheet.xls"

C#:
GetWorksheetNames.exe "C:\Temp\My_Worksheet.xls"

In both cases, it would return:

Foo
Bar
Foo Bar

to stdout.

I'd like it to be as fast and efficient as possible, so would prefer an .exe
over a script if possible. However, I'm a novice with VB and C#
programming, but otherwise an OK programmer.

FYI, this is just to integrate the Excel data with another language (SAS).
SAS can import Excel data automatically, but cannot determine the name of
the worksheets; you have to hardcode the worksheet names. If I can write
some code that queries the spreadsheet for its worksheet names, I can use
that as "glue" to build the proper syntax in SAS to import the Excel data.
So, I don't need to get at the data itself, just the worksheet names.

Thanks for any input you can provide.

Regards,
Scott


 
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
Retrieving last actual value in a list jonny Excel Discussion (Misc queries) 5 April 11th 08 01:55 PM
Retrieving a specific cell from multiple worksheets TheShaolin Excel Worksheet Functions 5 June 9th 06 08:31 PM
Retrieving deleted Excel files/worksheets Central Excel Discussion (Misc queries) 1 April 20th 05 09:14 AM
Pivot table retrieving data from several worksheets Gizmo Excel Worksheet Functions 2 December 29th 04 02:43 AM
Programmatically addressing worksheets - painfully stupid question Chip Pearson Excel Programming 1 September 8th 03 03:02 PM


All times are GMT +1. The time now is 03:16 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"