Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel Help
Message
De
08/12/2007 09:17:53
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
05/12/2007 22:14:10
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
01273504
Message ID:
01274145
Vues:
8
I always change .Selection to a cell object, e.g.
This.oSheet.Cells(lnCurrentRow, xlRow_C).SomeProperty

* A separate file has convenient constants for columns, including
* #define xlRow_C 3
* This.oSheet was previously set up to point to the current worksheet
or to a range object,
This.oSheet.Range(This.oSheet.Cells(1,1), This.oSheet.Cells(3,3)).SomeProperty
* Which I simplify with appropriate WITH statements,
* or with a UDF that returns an Excel Range.
>I'm trying to control Excel from VFP. I can make the change in Excel but I can't figure out how to get VFP to control Excel to do the same thing.
>
>I need to change the formatting of one column of a spreadsheet.
>
>I used the macro recorder which gave me the following code:
>
> Columns("P:P").Select
> With Selection
> .HorizontalAlignment = xlLeft
> .Orientation = 0
> .AddIndent = False
> .IndentLevel = 0
> .ShrinkToFit = False
> .ReadingOrder = xlContext
> End With
>
>How can I change this to execute as VFP code?
>Note: the object reference to the spreadsheet is: loActiveSheet
>
>I got this far:
>
> WITH loActiveSheet
> .Columns("P:P").Select
> With Selection && this line fails to compile
> .HorizontalAlignment = xlLeft
> .Orientation = 0
> .AddIndent = .F. && false
> .IndentLevel = 0
> .ShrinkToFit = .F. && False
> .ReadingOrder = xlContext
> END WITH && this line fails to compile
> ENDWITH && loActiveSheet
>
>I can figure out the Excel constants, but I can't figure out how to convert the "With Selection" line.
>
>
>Thanks!
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform