Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with automating spreadsheet containing VBA code
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00736099
Message ID:
00903224
Views:
25
I cannot reproduce theis behavior. Could you send the Excel file to me?

>Hi, I am trying to search for a particular caption name of a button in an Excel spread sheet.
>However, when, I use the following great code -- taken from this thread -- ,
>everything but the caption changes, as the program executes? Is there a way to get to
>the individual captions. I have tried Intellisense but got no further
>Thanks
>Steve
>
>OExcel= GetOBJECT(, "Excel.Application")
>OExcel.Visible=.t.
>for isheet=1 to OExcel.Worksheets.Count
>with OExcel.Worksheets(isheet)
>if .Shapes.Count>0
>for ia=1 to .Shapes.Count
>WITH .Shapes(ia)
>IF .type= 8 AND .FormControlType=0 &&msoFormControl and XLButtonControl
>.select
>mSheet = oExcel.Worksheets(isheet).name
>mCount = TRANSFORM(ia) + " of a total of " + TRANSFORM(oExcel.Worksheets(isheet).Shapes.Count)
>mType = transform(.type)
>&& can also be mCaption= transform(oexcel.selection)
>mCaption= transform(oexcel.selection.Characters.Text)
>mAction = transform(.OnAction)
>
>wait WINDOW ;
>" Worksheet " + mSheet +chr(13)+; && works changes with each iterations
>mCount +chr(13)+; && works
>" Type: " + mType +chr(13)+; && works
>" Caption: " + mCaption +chr(13)+; && caption always the same ??
>" onAction: " + mAction && works
>
>endif
>endwith
>endfor
>endif
>endwith
>endfor
>endif
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform