Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Accessing Excel worksheet names via ASP.Net 2.0

Hello,
I want to receive the worksheet names for random Excel sheets, the below
mentioned solution works for most excel sheet but with the most important one
I get too many excel sheets in this format

'WS1$' ''this one works
'WS1$'print_tables
'WS2$'Z_XX_XXX
'WS2$'Print_area

Where does the stuff after the $' come frome and how can I avoid this and
just receive the actual worksheet names ('WS1$') and at best in the order the
occur in the document and not alphabetically.

Thanks very much for your support and I hope i phrased the question in an
understandable fashion
Jörg


Code to get the Excel schema
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;""";
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
connection.Open();
worksheets = connection.GetSchema("Tables");
}


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Accessing Excel worksheet names via ASP.Net 2.0

Does this help?
Sub ShtNames()
n1 = ActiveWorkbook.Sheets.Count
ReDim ShtNames(n1)
For i1 = 1 To n1
ShtNames(i1) = Worksheets(i1).Name
Next
End Sub


"joerg.schad" wrote:

Hello,
I want to receive the worksheet names for random Excel sheets, the below
mentioned solution works for most excel sheet but with the most important one
I get too many excel sheets in this format

'WS1$' ''this one works
'WS1$'print_tables
'WS2$'Z_XX_XXX
'WS2$'Print_area

Where does the stuff after the $' come frome and how can I avoid this and
just receive the actual worksheet names ('WS1$') and at best in the order the
occur in the document and not alphabetically.

Thanks very much for your support and I hope i phrased the question in an
understandable fashion
Jörg


Code to get the Excel schema
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;""";
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
connection.Open();
worksheets = connection.GetSchema("Tables");
}


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Accessing Excel worksheet names via ASP.Net 2.0

The ActiveWorkbook Object is only referring to the currently open Excel
Sheet, or how can I declare on eExcel Workbook as active?
I need to access those excel documents on a server (without Excel...)
Still thank you very much for your answer
Jörg

"Gleam" wrote:

Does this help?
Sub ShtNames()
n1 = ActiveWorkbook.Sheets.Count
ReDim ShtNames(n1)
For i1 = 1 To n1
ShtNames(i1) = Worksheets(i1).Name
Next
End Sub


"joerg.schad" wrote:

Hello,
I want to receive the worksheet names for random Excel sheets, the below
mentioned solution works for most excel sheet but with the most important one
I get too many excel sheets in this format

'WS1$' ''this one works
'WS1$'print_tables
'WS2$'Z_XX_XXX
'WS2$'Print_area

Where does the stuff after the $' come frome and how can I avoid this and
just receive the actual worksheet names ('WS1$') and at best in the order the
occur in the document and not alphabetically.

Thanks very much for your support and I hope i phrased the question in an
understandable fashion
Jörg


Code to get the Excel schema
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;""";
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
connection.Open();
worksheets = connection.GetSchema("Tables");
}


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
using the Excel generic worksheet names instead of user-given names in code Paul Excel Discussion (Misc queries) 5 June 26th 09 08:44 PM
Put worksheet names into worksheet Excel 2000? James Cooper Excel Programming 3 July 7th 06 04:48 AM
Problem with accessing names across sheets [email protected] Excel Discussion (Misc queries) 1 March 29th 06 01:43 AM
How to link Excel worksheet tab names to dates in each worksheet? Pat Excel Worksheet Functions 9 January 31st 05 07:51 AM
VBA Functions accessing value from worksheet sachinshah Excel Programming 1 September 15th 03 04:07 PM


All times are GMT +1. The time now is 04:29 AM.

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

About Us

"It's about Microsoft Excel"