Error in calling XlWrkSht.Shapes
WL
Member Posts: 12
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
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
-
Hi
I have used this coding with successRowNo := 1; ColumnNo := 1; Range := GetColumnStr(1) + FORMAT(RowNo); Sheet.Range(Range).Select; Sheet.Range(Range).Activate; Sheet.Shapes.AddPicture(ENVIRON('TEMP') + '\Logo.bmp',1,1,0,0,150,50);
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
Albert0 -
Hi 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,
WL0 -
Hi WL
instead of getcolumnstr use GetColumnID in the buffer table
and replace Sheet by XlWrkSht in the coding.
Albert0 -
Hi 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,
WL0 -
Hi 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: )
Albert0 -
Hi Albert,
Yes, I am printing whatever shown on the report out to excel.
Finally, I have gotten everything working. Thanks alot.
WL0 -
Glad I could help
Albert0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions