Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I convert VB macros to VFP
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00550965
Message ID:
00550970
Views:
24
>Hi All
>
>Is there a set of rules anywhere that define how to convert xl (VB ) macro code to vfp - The following is a snippet of the macro generated by XL. I have already created my loXL object.
>
>with loXl
>
> .ActiveSheet.Shapes.AddLabel(msoTextOrientationHorizontal, 11.25, -2.25, 0# , 0#).Select
> .Selection.ShapeRange(1).TextFrame.AutoSize = msoTrue
> .Selection.Characters.Text = ;
> "MOAT TRUCK SALES" + Chr(10) + "LINK 56" + Chr(10) + "ZONE 3" + Chr(10) + "WEIGHBRIDGE ROAD, DEESIDE IND. PARK" + Chr(10) + "CH52LL"
> With loXl.Selection.Characters(Start:=1, Length:=17).Font
> .Name = "Arial"
> .FontStyle = "Bold"
> .Size = 12
> .Strikethrough = False
> .Superscript = False
> .Subscript = False
> .OutlineFont = False
> .Shadow = False
> .Underline = xlUnderlineStyleNone
> .ColorIndex = xlAutomatic
> EndWith
>
>endwith
>
>Virtually all the lines except the 3rd fail, unrecognised command. I have included the excel.h file and defined the two mso variables. I have also replace the underscores with ; and the & with the + sign.
>
>Any help would be appreciated
>Thanks
>Derek

At first glance, I don't see a problem with the third line but with the fourth. In VFP you will have to pass parameters by position since passing them by name is not supported. If Start and Lenght are the first two parameters in the function definition then you need to replace it with "Characters(1,17)".
HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform