General information
Category:
COM/DCOM and OLE Automation
Title:
Selecting cells in excel ole automation
I am accessing an excel speadsheet via ole automation in my VFP program.
I start excel and open the speadsheet.
objExcel = CreateObject("Excel.Application")
xlquote = objExcel.WorkBooks.Open("g:\quotesheet\quotesheet.xls")
I want to select all of the data on sheet1.
I can select cell A1 like this
xlquote.worksheets("sheet1").range("A1").select
I can select a range of cells like this
xlquote.worksheets("sheet1").range("A1","O5").select
However, when I try to use this code which I found on several VBA sites
as the method to select all the cells containing data on the
sheet I get an error in foxpro.
"Variable XLLASTCELL not found"
xlquote.worksheets("sheet1").range("A1",xlquote.worksheets("sheet1").activecell.specialcells(xlLastCell)).select
this code, as a macro in excel does work.
range("A1").select
range("A1",activecell.specialcells(xlLastCell)).select
What do I need to do to make xlLastCell available to VFP?
Or, is there another method to do this?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only