Forms to Excel example with webutil
Hello all,
I am working on an application that uses the OLE_WRITE procedure to output to an excel document. I have used the example to write to Word which works just fine. I am trying to modify the code to work with Excel instead of Word, but I am having issues. When I try to run the form I get the error:
wuo-712 Unable to set Property: Text, exception com.jacob.com.ComFailException: Invoke of Text
Source Microsoft Office Excel
Description: Unable to set the Text property of the Range class
And here is the code I am using:
app := CLIENT_OLE2.CREATE_OBJ('Excel.Application');
if :ole.silent = 'Y'
then
CLIENT_OLE2.SET_PROPERTY(app,'Visible',0);
else
CLIENT_OLE2.SET_PROPERTY(app,'Visible',1);
end if;
docs := CLIENT_OLE2.GET_OBJ_PROPERTY(app, 'Workbooks');
doc := CLIENT_OLE2.INVOKE_OBJ(docs, 'add');
selection := CLIENT_OLE2.GET_OBJ_PROPERTY(app, 'Selection');
-- insert data into new document from long item
CLIENT_OLE2.SET_PROPERTY(selection, 'Text', :ole.oletext);
I'm guessing it has something to do with the 'Text' property, most likely the sheet doesn't now what range to put the data. I am having difficulty finding an example of code out there to manipulate the cell range, so if anyone has any clues they would be greatly appreciated.
Thanks,
Jordan