Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Affecting Excel checkbox in code
Message
From
24/02/2011 15:43:58
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01501694
Message ID:
01501722
Views:
46
Thank you Sergey. You always seem to come through on my Excel issues. :)

The code you referenced...
PROCEDURE iCheckboxes

oExcel= getOBJECT(,"Excel.Application")
with oExcel.ActiveSheet

* assuming they were added from control toolbar
FOR ia=1 to .oleobjects.Count
WITH .oleobjects.Item(ia)
if "checkbox"$LOWER(.name)
.Object.value=.t. &&check it
endif
ENDWITH
ENDFOR
endwith

oExcel.Quit()
oExcel=null

RETURN

....when it reaches the "FOR" part it immediately jumps to "ENDFOR".

I'm checking the value of a field in my table...
If FILE.FIELD > 0
(this is where I want it to check a box)

This code dates back maybe 10 years and you'll notice has your name in it, for other things you've helped me with.

The code I'm using to call Excel is...
oleApp = CREATEOBJECT("Excel.Application") && Start Excel.
oleApp.DisplayAlerts=.F. &&GO SERGEY!!!!!!!!!
**THEN A BUNCH OF CODE TO CREATE FILENAME
If FILE(m.newfile)
**THEN A BUNCH OF CODE TO ALLOW USER TO SELECT DIFFERENT FILENAME OR ADD TO EXISTING
m.FILENAME=LEFT(NAME,LEN(NAME)-0)
oleApp.Workbooks.OPEN(m.newfile)
oleApp.Workbooks.OPEN(M.dir+"REPORTS\REPORTFORM.xls")
**THEN A BUNCH OF CODE TO CREATE THE WORKSHEET NAME
oleApp.Sheets("master").SELECT
Wait CLEAR
oleApp.Sheets("master").SELECT &&OK
oleApp.Sheets("master").NAME = ALLTRIM(m.newworksheet)
...I will have 12 different checkboxes based on varying conditions.

Can you please provide a little more insight into what the code you referenced is doing?

Thanks so much,
Martha
Previous
Reply
Map
View

Click here to load this message in the networking platform