Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLE automation question
Message
From
05/08/1999 19:10:12
 
 
To
05/08/1999 16:05:34
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00250316
Message ID:
00250498
Views:
46
>Here is the VBA code from the macro recording:
>
> Range("A1").Select
> With Selection
> .HorizontalAlignment = xlCenter
> .VerticalAlignment = xlBottom
> .WrapText = False
> .Orientation = 0
> .ShrinkToFit = False
> .MergeCells = False
>
>I changed it to:
>
> OleApp.Range("A1").Select
> With OleApp.Selection
> .HorizontalAlignment = xlCenter
> .VerticalAlignment = xlBottom
> .WrapText = False
> .Orientation = 0
> .ShrinkToFit = False
> .MergeCells = False
> endwith
>
>but when I run it, i get a message that the variable xlCenter can't be found
>
>I have also tried putting xlCenter in quotes and i got a very arcane message -
>OLE ldispatch exception code 1004 from Excel:unable to set the HorizontalAlignment property of the Range class....
>
>in the excel help file for VBA it says that the HorizontalAlignment property "applies to" the Range object
>
>Hope this clarifies the problem some

These "variables" that start with xl are not variables, but constants. They are defined in Excel.h. You can inlude this file in your class, prg, whatever, or you can just use the literal value of the constats instead. To find out the value of excel constants, in Excel, go to tools-> macros -> VBA editor. In the VBA editor, press F2 to get the Excel object browser. Type in the name of the constant you are looking for and observe its literal value at the bottom of the browser.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform