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:
00736175
Views:
24
This message has been marked as the solution to the initial question of the thread.
Additionally this is a code fragment that helped me to navigate through the document in situation like yours and find buttons, their captions and when clicked action. Let us suppose you have xls file open:
ObjExcel= GetOBJECT(, "Excel.Application")
*ObjExcel.DisplayAlerts = .f.
*ObjExcel.Visible=.t.

*Sheets may be visible (-1 or 1), not visible (0) or very hidden xlVeryHidden,2

for isheet=1 to ObjExcel.Worksheets.Count
?ObjExcel.Worksheets(isheet).name
with ObjExcel.Worksheets(isheet)
if .Shapes.Count>0
for ia=1 to .Shapes.Count
WITH .Shapes(ia)
?.Name,", Type: ",.type, 
IF .type= 8 AND .FormControlType=0 &&msoFormControl and XLButtonControl
.select
??", Caption: ",objexcel.selection.Characters.Text
??", onAction: ",.OnAction
endif
endwith
endfor
endif
endwith
endfor

ObjExcel=.null.
release objexcel
Hope it gives you some useful things to consider.

>Yes, I found an unprotected version of the spreadsheet but the controls still don't show up in the OLEOBJECTS collection. The only difference between the forms (that I can see) is that I can modify the properties of the controls in Design Mode.
>
>>You mentioned in your previous related post that there is a password protection for VB code in the file. Did you get a password?
>
>>>I finally figured out how to access and modify controls on an Excel spreadsheet but no matter what I do, I can't access the controls on one of my spreadsheets. It has VBA macros and the controls (Option buttons and comboboxes) look and behave different than the ones supplied with Excel. I didn't create this spreadsheet and I'm still trying to contact the person who did but I need to figure this out soon.
>>>
>>>Any idea on what's not allowing me to see the spreadsheet's controls? Any help would be appreciated. Thank you.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform