ThunderForest
IS-IT--Management
v 7.1.3
I have a report that has a subreport with a date prompt in it. I'm trying to write a macro so I can run this report automatically without any intervention. How do I pass the dates to the prompt? I did see examples where the prompt could be created within the script, but this prompt already exists in the report and I wanted to leave this report in tact. Here's what I have so far:
Getting answers before I'm asked.
Providing answers if I can.
I have a report that has a subreport with a date prompt in it. I'm trying to write a macro so I can run this report automatically without any intervention. How do I pass the dates to the prompt? I did see examples where the prompt could be created within the script, but this prompt already exists in the report and I wanted to leave this report in tact. Here's what I have so far:
Code:
Sub Main()
Dim objImpApp as Object
Dim objImpRep as Object
Dim objPDFPub as Object
'These are the prompt values
bDate = Format(CStr(CVar(Date-1)),"yyyy-mm-dd")
eDate = Format(CStr(CVar(Date-1)),"yyyy-mm-dd")
Set objImpApp = CreateObject("CognosImpromptu.Application")
objImpApp.Visible True
objImpApp.OpenCatalog "\\powervault\commonshare$\Cognos\Catalogs\LaborReporting.cat","User",,,,1
Set objImpRep = objImpApp.OpenReport("\\powerServer\common$\Cognos\EmployeeHours.imr")
objImpRep.Reexecute
' Set objPDFPub = objImpRep.PublishPDF
' objPDFPub.Publish "c:\my documents\RptRepository\EmployeeHours.Pdf"
objImpRep.CloseReport
objImpApp.Quit
Set objImpApp = Nothing
Set objImpRep = Nothing
Set objPDFPub = Nothing
End Sub
Getting answers before I'm asked.
Providing answers if I can.