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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Object

Status
Not open for further replies.

elibb

Programmer
Oct 22, 2001
335
0
0
MX
hi, i have a vb6.0 application, and im trying to use an excel sheet to fill a Grid.

i checked the reference to Miscrosoft excel, and im trying to do it like this:

Dim oExcel As Excel.Worksheet
Set oExcel = GetObject("E:\FileName.xls")

but i get an error with incompatible types.. does anybody know what class should i use?
i tried Excel.Application, Excel.WorkBook and none worked..

what i need is to copy by code the sheet to a grid i have on my form.

thank you very much

Eli
 
Something like this works in Access VBA:

Dim oXL As Excel.Application
Dim oBook As Excel.Workbook
Dim oSheet As Excel.Worksheet

' Create a new instance of Excel and make it visible.
Set oXL = CreateObject("Excel.Application")

' Add a new workbook and set a reference to Sheet1.
Set oBook = oXL.Workbooks.Add
Set oSheet = oBook.Sheets(1)

' and so on....

 
mm what i need is to work with an existing excel file

Eli
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top