I have DTS package that calls a Macro detailed below.
-----------------------------------------
'File Constants
Global Const ReportName = "AM_AC1_pdf"
Global Const ReportInputPath = "d:\gains\erm\mayne\reports\input"
Global Const ReportOutputPath = "e:\reports\PLANNER_AC1"
Global Const GAINSCatalogPath = "d:\gains\erm"
Global Const GAINSCatalog = "gainssql2005.cat"
Global Const dbUserId = "sa"
Global Const dbUserPwd = "sa"
Sub Main()
Dim objImpApp as Object
Dim objImpRep as Object
Dim objPDFPub as Object
Set objImpApp = CreateObject("Impromptu.Application")
objImpApp.Visible 0
objImpApp.OpenCatalog GAINSCatalogPath & "\" & GAINSCatalog , "Creator", , dbUserId, dbUserPwd
Set objImpRep = objImpApp.OpenReport (ReportInputPath &"\"& ReportName & ".imr")
objImpRep.Reexecute
Set objPDFPub = objImpRep.PublishPDF
objPDFPub.Publish ReportOutputPath &"\"& ReportName &""+ "_"+ mid$(date$,7,4)+ mid$(date$,1,2)+ mid$(date$,4,2) +".pdf"
objImpRep.CloseReport
objImpApp.Quit
Set objImpApp = Nothing
End Sub
-----------------
However, the process hangs, I have tried debuggin this and it tells me that "This action cannot be completed because the other program is busy...."
I think there is a problem with the CreateObject... I have tried "Set objImpApp = CreateObject("CognosImpromptu.Application")" but the same thing happens.
What is wrong?
Thanks for your help in advance
-----------------------------------------
'File Constants
Global Const ReportName = "AM_AC1_pdf"
Global Const ReportInputPath = "d:\gains\erm\mayne\reports\input"
Global Const ReportOutputPath = "e:\reports\PLANNER_AC1"
Global Const GAINSCatalogPath = "d:\gains\erm"
Global Const GAINSCatalog = "gainssql2005.cat"
Global Const dbUserId = "sa"
Global Const dbUserPwd = "sa"
Sub Main()
Dim objImpApp as Object
Dim objImpRep as Object
Dim objPDFPub as Object
Set objImpApp = CreateObject("Impromptu.Application")
objImpApp.Visible 0
objImpApp.OpenCatalog GAINSCatalogPath & "\" & GAINSCatalog , "Creator", , dbUserId, dbUserPwd
Set objImpRep = objImpApp.OpenReport (ReportInputPath &"\"& ReportName & ".imr")
objImpRep.Reexecute
Set objPDFPub = objImpRep.PublishPDF
objPDFPub.Publish ReportOutputPath &"\"& ReportName &""+ "_"+ mid$(date$,7,4)+ mid$(date$,1,2)+ mid$(date$,4,2) +".pdf"
objImpRep.CloseReport
objImpApp.Quit
Set objImpApp = Nothing
End Sub
-----------------
However, the process hangs, I have tried debuggin this and it tells me that "This action cannot be completed because the other program is busy...."
I think there is a problem with the CreateObject... I have tried "Set objImpApp = CreateObject("CognosImpromptu.Application")" but the same thing happens.
What is wrong?
Thanks for your help in advance