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 27th, 2005, 02:39 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
how to read data from excel if sheet name is not known

I have to create one application in VB, which retreives data from excel sheet but the sheet name is not fixed so do i retreive records using recordset
Please tell me its very urgent
Any help will be appreciated.
Thanx in advance

Reply With Quote
  #2  
Old April 27th, 2005, 08:53 AM
Marc Van Beeume Marc Van Beeume is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 6 Marc Van Beeume User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 53 sec
Reputation Power: 0
Hi,

Your question is not very specific.

The problem occurs i think when Excel has more than 1 worksheet in the workbook and the workbook has been saved with another worksheet active than the one the data are on. If there is only 1 worksheet it is always the active worksheet that is active when you open the workbook.

Maybe there is a keyword somewhere on the datapage that you can look for ?
The way to do this in VBA is to scroll through the worksheets with the following routine (lets suppose the keyword = "NAME" in cell C2 of the worksheet with the data

Code:
Dim Counter As Integer 
 
For Counter = 1 To Worksheets.Count
If Worksheets(Counter).Range("C2").Value = "NAME" Then
	Worksheets(Counter).Activate
	'...put the routine for reading the data here
End If
Next

Maybe this solves your problem

Kind regards
Marc

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > how to read data from excel if sheet name is not known


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 6 hosted by Hostway