Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to open "sheet2" of spreadsheet with ole

Status
Not open for further replies.

breukelen

Technical User
Oct 31, 2001
54
NL
Good evening,

I used

oleapp=createobject("Excel.Application")
oleapp.visible=.T.
oleapp.workbooks.open("c:\my.xls")
oleapp.visible=.T.

This works o.k. , it opens with sheet1.
What is the "ole" ,so that it opens for instance with sheet2
Thank in advance for your help.

Gunter

 
I don't remember where I got this code, most likely it was some combination of Getz's Developers Handbook and the microsoft Knowledgebase.


This will set a reference to your sheet2:
Dim objXLApp As Excel.Application
Dim objXLBook As Excel.Workbook
Dim objDataSheet As Excel.Worksheet

Set objXLBook = GetObject(sXLSPath & sXLSName)
Set objDataSheet = objXLBook.Worksheets("Sheet2")

Luther
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top