General information
Category:
COM/DCOM and OLE Automation
This is the code I was using to test OLEOBJECTS, but I soon realized that it wasn't finding the controls on each sheet.
lcFile = GETFILE("XLS")
IF EMPTY(lcFile)
RETURN
ENDIF
oExcel = CREATEOBJECT("Excel.application")
oWorkbook = oExcel.Workbooks.OPEN(lcFile)
lnSheetCnt = oWorkbook.Worksheets.COUNT
? lcFile && Display XLS file name
FOR lnSheet = 1 TO lnSheetCnt
oWorkSheet = oWorkbook.Worksheets(lnSheet)
? "Sheet #" + ALLTRIM(STR(lnSheet)) + " (" + ALLTRIM(oWorkSheet.NAME) + ")" && Display Sheet Number and Name
? SPACE(5) + "Object Count: " + ALLTRIM(STR(oWorkSheet.OLEOBJECTS.COUNT)) && Display Object Count
FOR nObj = 1 TO oWorkSheet.OLEOBJECTS.COUNT
? SPACE(5) + oWorkSheet.OLEOBJECTS.NAME && Display each object on this sheet
NEXT
NEXT
oExcel.Quit()
RELEASE oWorkSheet, oWorkbook, oExcel
RETURN
>How do you call oleobjects? AFAIK, they belong to particular sheet:
>?ObjExcel.Worksheets(2).OLEObjects.Count
>>I'm currently writing a program to automate the creation of a purchase order for my company. The spreadsheet already exists and I have no problem filling in the cell values. The problem is that there are option buttons, checkboxes, comboboxes that I need to check the current value and then write a new value. I've looked at the Excel object model many times and I must be missing something. I thought I found the solution by using the OLEOBJECTS collection but each sheet had a COUNT of 0.
>>
>>Any help would be appreciated. Thanks.
>>
>>Aaron Jacka
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only