PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Accessing Excel worksheet names via ASP.Net 2.0

 
 
=?Utf-8?B?am9lcmcuc2NoYWQ=?=
Guest
Posts: n/a
 
      16th Nov 2007
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 With Quote
 
 
 
 
=?Utf-8?B?R2xlYW0=?=
Guest
Posts: n/a
 
      16th Nov 2007
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 With Quote
 
=?Utf-8?B?am9lcmcuc2NoYWQ=?=
Guest
Posts: n/a
 
      19th Nov 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
using the Excel generic worksheet names instead of user-given names in code Paul Microsoft Excel Misc 5 26th Jun 2009 08:44 PM
Excel Worksheet Names jrp7286@yahoo.com Microsoft Excel Worksheet Functions 2 19th Apr 2007 07:02 PM
Put worksheet names into worksheet Excel 2000? James Cooper Microsoft Excel Programming 3 7th Jul 2006 04:48 AM
How to get worksheet names from an excel file? Terry Olsen Microsoft VB .NET 4 9th Feb 2006 11:26 PM
How to link Excel worksheet tab names to dates in each worksheet? =?Utf-8?B?UGF0?= Microsoft Excel Worksheet Functions 9 31st Jan 2005 07:51 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:21 PM.