Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Macro to VFP
Message
From
04/01/2001 16:15:17
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00459543
Message ID:
00459561
Views:
20
>You will need to reference the office automation documentation for the AutoFormat() method. VFP does not support named parameters like in the macro so you will need something like

oSheet.Selection.AutoFormat(xlRangeAutoFormatSimple,.F.,.F.,,.F.,.F.,.T.)

>Basically you need to know the order of all the parameters so you can put in the appriate numbers of commas, skipping parameters you don't use and including the ones you do.

This is about right. I have had to do this a lot in my app. So much so that I created a wrapper class to control Excel from VFP with. That way you code this kind of thing only in one place, where you can be sure it is right. Implement new methods in your little wrapper class as you find they are needed.

I have found the MS office object browser to be invaluable in doing this sort of thing. Go into the visual basic editor from the macro menu in Excel, and hit F2. The whole object model is available here for browsing properties and methods.

One other thing, that xlRangeAutoFormatSimple is an enumerated constant in excel, which you can find out is eqivalent to some number, like a 2 or something, and THAT is what you pass in the VFP method invocation, because it won't know what xlRangeAutoFormatSimple refers to.
Jim Newsom
IT Director, ICG Inc.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform