getting the sheet names present in a work book????

  • Thread starter Reny J Joseph Thuthikattu
  • Start date
R

Reny J Joseph Thuthikattu

Hi,
I want to dump some date from a excel file to a database.So i am using
VB.NET , Excel 2003 to do so.I want to know how do i get the names of the
sheets present in a workbook and would like to know is there is any way to
identify the column names in a worksheet??????

Regards

Reny
 
B

Bob Phillips

This is VBA, so you will need to translate to .NET

Sheet names

For Each sh In Activeworkbook
Debug,.Print sh.Name
Next sh

Column names. You mean thge value in Row 1?

Cells(1,"A").Value

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
R

Reny J Joseph Thuthikattu

Thanx .I am able to figure it out

Dim xlApp As Excel.Application

Dim xlWB1 As Excel.Workbook

Dim x1WS1 As Excel.Worksheet

xlApp = New Excel.Application()

xlApp.Visible = True

xlWB1 = xlApp.Workbooks.Open("C:\2004.xls")

For Each x1WS1 In xlWB1.Worksheets

MsgBox(x1WS1.Name())

Next

xlWB1.Close()

xlApp = Nothing



Reagdrs



Reny
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top