Hi,
Does anyone know why
XlWrkSht.Shapes.AddPicture('c:\test.bmp', 1, 1, 20, 20, 100, 100);
will give me the error
"Could not invoke the member Shapes. The OLE Control or Automation server returned the following message: The requested member does not exist, or the call tried to set the value of a read-only property."
I am able to see Shapes when I am at the C/AL Symbol Menu
How to resolve this error?
Thanks,
WL
0
Comments
I have used this coding with success
where Sheet is variable of subtype 'Microsoft Excel 11.0 Object Library'.Worksheet
Also check that the sheet is active using
CLEAR(App);
CREATE(App);
App.Visible(FALSE);
Book := App.Workbooks.Add(-4167);
Book.Worksheets.Add;
Sheet := App.ActiveSheet;
Hope this helps
Albert
I have created a function in the Exel Buffer Table.
The function contains the following coding:
createbook;
XlWrkSht.Shapes.AddPicture('c:\test.bmp', 1, 1, 20, 20, 100, 100);
I did not copy exactly your coding as there isn't any GetColumnStr
I have check that the subtype is 'Microsoft Excel 11.0 Object Library'.Worksheet
Now I am getting 'Excel not found'.
Please advice.
Thanks,
WL
instead of getcolumnstr use GetColumnID in the buffer table
and replace Sheet by XlWrkSht in the coding.
Albert
Thanks. I can get in working now.
However, I have another problem. Currently, I am export inga report to an excel. I need to export an image which is at the footer of the report. How should the paramaters be written in the AddPicture? I do not know the XPOS and YPOS Position due to I have no ideas how many details will be generated.
Thanks,
WL
Are you printing each header of the report into theexcel file?
I think you will have to play around with the first 2 parameters
Sheet.Shapes.AddPicture(ENVIRON('TEMP') + '\Logo.bmp',1,1,0,0,150,50);
The 1,1 in the above statement are the row and column numbers (I can't remeber :roll: )
Albert
Yes, I am printing whatever shown on the report out to excel.
Finally, I have gotten everything working. Thanks alot.
WL
Albert