- Dennis Little
- PowerBuilder
- Tuesday, 13 August 2024 06:11 PM UTC
Hello all,
We're working on a project that will open Excel, call a stored procedure, create a chart, print as a pdf then close.
Using PB2022R2 Build 2828.
Thanks to Tobias we have a very nice OLE example that does everything we need, except the ability to add arguments. We've done that thru a command line in the past, but was hoping to build on the OLE code.
It looks like Excel-VBA will allow arguments, just not sure of the OLE syntax.
Excel sample - Application.Run "'" & wb.Name & "'!routine_name", True
Thanks,
Dennis
Tobias' example
oleobject ole_excel
ole_excel = create oleobject
ll_ret = ole_excel.ConnectToNewObject("Excel.Application")
if ll_ret <> 0 then
MessageBox("Error", "Could not create Excel object (" + string(ll_Ret) + ")!~nIs Microsoft Excel installed?", Exclamation!)
destroy ole_excel
end if
ole_excel.Visible = true;
// PDF speichern
ole_excel.WorkBooks.Open(ls_source)
oleobject lole_worksheet,lole_workbook
lole_workbook = ole_excel.application.workbooks(1)
lole_worksheet = lole_workbook.worksheets(1)
lole_worksheet.SaveAs(ls_pdf, 57);
ole_excel.Quit()
ole_excel.DisconnectObject()
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.