Hi guys!
Hope somebody can help me with this...
I use excel Automation-obj to fill several data into a sheet. This happens not visible to the user,
in background. After data are filled in, I want to save the sheet as PDF, and then open it.
I used the vba-editor to get an idea of how to call the right function.
Result is: Excel uses "ExportAsFixedFormat"
I've tried several parameters, but the command always fails with error -2147352567.
Searching for description at google and microsoft didn't helped a lot.
Does anybody got a hint?
Or does someone already have a solution for saving excel as PDF from C/AL?
Appreciate every help!
0
Comments
When I remove the Export-Command from C/AL (or comment-out), and trigger it as macro from the open Excel, it works perfect.
And the macro code stays quite the same:
Im using Excel a lot too. Maybe try to replace the explicit parameters with vars.
So
''
becomes
LtStringEmty := '';
0
becomes
LiZero := 0;
TRUE
becomes
LbTRUE := true;
etc.
xlSheet.ExportAsFixedFormat(LiZero ,'C:\exports\dataRange.pdf',LiZero,LbTRUE,LbFALSE,LtZero,LtStringEmty,LbTRUE);
ps.
Whats helps too is not use integers or strings but use variants vars like LvTRUE := true;
I still get the exception....
For now, I will call a macro with the export command.
But I don't like doing it that way at all, cause I have to save my template with macros,
and furthermore, edit the security settings of excel, to permit execution of it.
The way I call the macro:
thanks again
regards,
winfy