Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 24th, 2005, 11:42 PM
cjreynolds cjreynolds is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 352 cjreynolds User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 10 h 35 m 11 sec
Reputation Power: 4
Referring to sheets in excel

I'm using ASP/VBScript to look at the contents of an excel file. I know how to refer to a sheet by name:
Code:
set ExcelRS = ExcelConn.Execute ("SELECT * FROM [Sheet1$]")

but how do I refer to the first sheet, second sheet, last sheet, etc. if I don't know the names of the worksheets?

Reply With Quote
  #2  
Old April 27th, 2005, 03:31 PM
cjreynolds cjreynolds is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 352 cjreynolds User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 10 h 35 m 11 sec
Reputation Power: 4
Found another solution - for those interested:
Code:
<%
Dim objInputXLS
Dim ObjInputWorkBook
Dim ObjInputSheet
Dim datStartTime
Dim datEndTime
Set objInputXLS = CreateObject("Excel.Application")
Set ObjInputWorkBook = objInputXLS.Workbooks.Open("c:\inetpub\wwwroot\asp\calendar\test.xls")
Set ObjInputSheet = ObjInputWorkBook.Worksheets(1)
 
Response.Write(ObjInputSheet.Cells(11,6))

 
objInputXLS.ActiveWorkbook.Close True, "c:\inetpub\wwwroot\asp\calendar\test.xls"
Set ObjInputSheet = Nothing
Set ObjInputWorkBook = Nothing
Set objInputXLS = Nothing
%>

Reply With Quote
  #3  
Old April 29th, 2005, 06:13 AM
hithere's Avatar
hithere hithere is offline
Learner
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: India
Posts: 450 hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 12 h 13 m 21 sec
Reputation Power: 17
Hey to know the sheets name u can use this
excel_app.workbooks.open(xls file name)
Set excel_app = CreateObject("Excel.Application")
excel_app.Workbooks.Open (excelfile_name)
For i = 1 To ActiveWorkbook.Sheets.Count
shtname(i) = Sheets(i).Name
Exit For
Next

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Referring to sheets in excel


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT