Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Read Specific cell value from excel sheet using VBScript

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,62195
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Read Specific cell value from excel sheet using VBScript
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Read Specific cell value from excel sheet using VBScript - 7/7/2008 4:16:57 PM   
  rahul9255

 

Posts: 2
Score: 0
Joined: 7/7/2008
Status: offline
Original message moved by ebgreen
Reason : Moved to proper forum
Hi,

I am trying to read value from specific cell from Excel sheet. Following is the script

1 Dim xlApp
2 Dim xlBook
3 Dim xlSheet
4
5 Set xlApp = CreateObject("Excel.Application")
6 xlApp.visible = true
7 Set xlBook = xlApp.Workbooks.open("D:\Macro\BirthDay.xls")
8
9
10 Set xlSheet = xlBook.Worksheets("Sheet1")
11 MsgBox  xlSheet.Cells(1, A1).Value

When I run this script the following error comes up

Line: 11
Column: 1
Error: Unknown run time error
Code: 800A03EC
Source: Microsoft VBScript Runtime error
System: Invalid Flags.

Please help me out.

Regards,

Rahul
 
 
Post #: 1
 
 RE: Read Specific cell value from excel sheet using VBS... - 7/9/2008 12:33:00 AM   
  ebgreen


Posts: 5041
Score: 31
Joined: 7/12/2005
Status: offline
Try this:

MsgBox  xlSheet.Cells(1, 1).Value

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to rahul9255)
 
 
Post #: 2
 
 RE: Read Specific cell value from excel sheet using VBS... - 7/9/2008 10:15:14 PM   
  rahul9255

 

Posts: 2
Score: 0
Joined: 7/7/2008
Status: offline
Thanks,

It worked.

Rahul

(in reply to ebgreen)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Read Specific cell value from excel sheet using VBScript Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts