Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How can I get all worksheets' names of the spreadsheet?

As you know, a excel spreadsheet workbook can contains some worksheets and
each worksheet has its names, my problem is how to get these names. Who can
Help me ?
Any help will be very very appreciated!
--
marxi
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default How can I get all worksheets' names of the spreadsheet?

Hi Marxi

Sub Worksheet_Names()
For Each ws In ThisWorkbook.Worksheets
Debug.Print ws.Name
Next ws
End Sub

will print the worksheet names to the Immediate Window. If you want
to print them to a worksheet itself, then maybe:

Sub Worksheet_Names()
For i = 1 to ThisWorkbook.Worksheets.Count
Cells(i,1).Value = ws.Name
Next i
End Sub

Hope this helps!

Richard


On 5 Feb, 07:45, marxi wrote:
As you know, a excel spreadsheet workbook can contains some worksheets and
each worksheet has its names, my problem is how to get these names. Who can
Help me ?
Any help will be very very appreciated!
--
marxi



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How can I get all worksheets' names of the spreadsheet?

first and foremost, thank you for your advise!

The spreadsheet I said is a kind of COM for Csharp.NET.
It can drog on the winform to work for users as excel.
my problem is how to get the name of each worksheet using C# language.
I do not know the type of "ws" which mentioned in your answer!
Thanks again.

--
marxi


"RichardSchollar" wrote:

Hi Marxi

Sub Worksheet_Names()
For Each ws In ThisWorkbook.Worksheets
Debug.Print ws.Name
Next ws
End Sub

will print the worksheet names to the Immediate Window. If you want
to print them to a worksheet itself, then maybe:

Sub Worksheet_Names()
For i = 1 to ThisWorkbook.Worksheets.Count
Cells(i,1).Value = ws.Name
Next i
End Sub

Hope this helps!

Richard


On 5 Feb, 07:45, marxi wrote:
As you know, a excel spreadsheet workbook can contains some worksheets and
each worksheet has its names, my problem is how to get these names. Who can
Help me ?
Any help will be very very appreciated!
--
marxi




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How can I get all worksheets' names of the spreadsheet?

In excel's vba:
Dim ws as worksheet


marxi wrote:

first and foremost, thank you for your advise!

The spreadsheet I said is a kind of COM for Csharp.NET.
It can drog on the winform to work for users as excel.
my problem is how to get the name of each worksheet using C# language.
I do not know the type of "ws" which mentioned in your answer!
Thanks again.

--
marxi

"RichardSchollar" wrote:

Hi Marxi

Sub Worksheet_Names()
For Each ws In ThisWorkbook.Worksheets
Debug.Print ws.Name
Next ws
End Sub

will print the worksheet names to the Immediate Window. If you want
to print them to a worksheet itself, then maybe:

Sub Worksheet_Names()
For i = 1 to ThisWorkbook.Worksheets.Count
Cells(i,1).Value = ws.Name
Next i
End Sub

Hope this helps!

Richard


On 5 Feb, 07:45, marxi wrote:
As you know, a excel spreadsheet workbook can contains some worksheets and
each worksheet has its names, my problem is how to get these names. Who can
Help me ?
Any help will be very very appreciated!
--
marxi





--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How can I get all worksheets' names of the spreadsheet?

C#can not use excel's vba and owc spreedsheet can not excute vba code.
I should use c# to solve this problem.
for example:
axSpreadsheet1.sheets.get_Names().ToString();
but "sheets" does not have the get_Names() method.
--
marxi


"Dave Peterson" wrote:

In excel's vba:
Dim ws as worksheet


marxi wrote:

first and foremost, thank you for your advise!

The spreadsheet I said is a kind of COM for Csharp.NET.
It can drog on the winform to work for users as excel.
my problem is how to get the name of each worksheet using C# language.
I do not know the type of "ws" which mentioned in your answer!
Thanks again.

--
marxi

"RichardSchollar" wrote:

Hi Marxi

Sub Worksheet_Names()
For Each ws In ThisWorkbook.Worksheets
Debug.Print ws.Name
Next ws
End Sub

will print the worksheet names to the Immediate Window. If you want
to print them to a worksheet itself, then maybe:

Sub Worksheet_Names()
For i = 1 to ThisWorkbook.Worksheets.Count
Cells(i,1).Value = ws.Name
Next i
End Sub

Hope this helps!

Richard


On 5 Feb, 07:45, marxi wrote:
As you know, a excel spreadsheet workbook can contains some worksheets and
each worksheet has its names, my problem is how to get these names. Who can
Help me ?
Any help will be very very appreciated!
--
marxi




--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How can I get all worksheets' names of the spreadsheet?

Maybe someone will jump in with the solution.

marxi wrote:

C#can not use excel's vba and owc spreedsheet can not excute vba code.
I should use c# to solve this problem.
for example:
axSpreadsheet1.sheets.get_Names().ToString();
but "sheets" does not have the get_Names() method.
--
marxi

"Dave Peterson" wrote:

In excel's vba:
Dim ws as worksheet


marxi wrote:

first and foremost, thank you for your advise!

The spreadsheet I said is a kind of COM for Csharp.NET.
It can drog on the winform to work for users as excel.
my problem is how to get the name of each worksheet using C# language.
I do not know the type of "ws" which mentioned in your answer!
Thanks again.

--
marxi

"RichardSchollar" wrote:

Hi Marxi

Sub Worksheet_Names()
For Each ws In ThisWorkbook.Worksheets
Debug.Print ws.Name
Next ws
End Sub

will print the worksheet names to the Immediate Window. If you want
to print them to a worksheet itself, then maybe:

Sub Worksheet_Names()
For i = 1 to ThisWorkbook.Worksheets.Count
Cells(i,1).Value = ws.Name
Next i
End Sub

Hope this helps!

Richard


On 5 Feb, 07:45, marxi wrote:
As you know, a excel spreadsheet workbook can contains some worksheets and
each worksheet has its names, my problem is how to get these names. Who can
Help me ?
Any help will be very very appreciated!
--
marxi




--

Dave Peterson


--

Dave Peterson
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
names in different worksheets a m spock Excel Worksheet Functions 2 January 6th 09 07:34 AM
How can I get worksheets' names in spreadsheet marxi Excel Worksheet Functions 3 February 5th 07 12:34 PM
Excel Spreadsheet from Access. List of names changes as names are Gordy w/Hi Expectations Excel Discussion (Misc queries) 1 October 21st 05 03:30 AM
Worksheets Names Paul Smith[_3_] Excel Programming 8 August 3rd 05 12:39 PM
Ok i have a spreadsheet with names Help me with this spreadsheet assignment Excel Discussion (Misc queries) 1 January 5th 05 09:46 PM


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