Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to group shapes in Excel by automation
Message
From
18/10/2005 07:24:13
 
 
To
18/10/2005 06:45:59
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01059852
Message ID:
01059866
Views:
10
Thank you, Borislav.

That missing '@' before the array name was exactly what I missed.

Lennert

>try this
>
>
>#define msoTextOrientationHorizontal 1 && I am not sure about this definem check it first
>
>oExcel = CREATEOBJECT("Excel.Application")
>oBook = oExcel.WorkBooks.Add()
>oExcel.Visible = .t.
>oBook.ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 51,  48, 60, 16.5).Select
>oBook.ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 51, 64.5, 60, 16.5).Select
>DIMENSION aaa[2]
>aaa[1] = "Text Box 2"
>aaa[2] = "Text Box 1"
>oBook.ActiveSheet.Shapes.Range(@aaa).Select
>oExcel.Selection.ShapeRange.Group.Select
>oExcel.Quit()
>oBook = NULL
>oExcel = NULL
>
>
>
>>Hello everyone
>>
>>I have a situation in which I want my program to group a set of shapes in Excel into one group. The shapes are textboxes. In order to do this, I started the macro recorder, built 2 textboxes,grouped them, switched to view the macro,and implement the code in my VFP program.
>>Essentially (left some unimportant propsettings out) this is the macro code:
>>
>>
>>    ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 51#, 48#, 60# _
>>        , 16.5).Select
>>    ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 51#, 64.5, 60# _
>>        , 16.5).Select
>>    ActiveSheet.Shapes.Range(Array("Text Box 2", "Text Box 1")).Select
>>    Selection.ShapeRange.Group.Select
>>
>>
>>It is easy enough to automate the first two statements and the fourth by VFP, but the third I cannot do, because of the ARRAY-call.
>>If I put the two strings "Text Box 2" and "Text Box 1" in a VFP array and give the array as an argument to Range() it doesn't work.
>>
>>So how to do this in VFP?
>>
>>Lennert
Previous
Reply
Map
View

Click here to load this message in the networking platform