Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting cells in excel ole automation
Message
De
11/07/2001 11:52:57
 
 
À
11/07/2001 11:37:44
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00529193
Message ID:
00529204
Vues:
15
Mike,
VBA make extensive use of constants. When you port VBA code to VFP you need to define these constants. The following should work:
#DEFINE xlLastCell 11
oSheet = xlquote.worksheets("sheet1")
oSheet.range("A1", oSheet.cells.specialCells(xlLastCell)).select
HTH
>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?
Daniel
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform