I have the exact same situation. I am happy to see someone trying to do the same. I run into some problems with this.
I have the following problem.
I have a "Wrapper Report". This is the main report. I have a prompt defined here and a variable which gets the value from the prompt. Now, I want to call the second report and pass the prompt values from macro.
I call the macro from main report and use GetDataValue to obtain the passed parameter. I try to use ActiveDocument to tell macro to use the main report as the calling report, but it complains. According to documentation, for ActiveDocument must have a report Open.
My macro which is called from my main report, looks like this
Sub Main()
Dim objImpApp As Object
Dim objImpRep As Object
Dim strReturnValue As String
Set objImpApp = CreateObject("CognosImpromptu.Application"
Set objImpRep = objImpApp.ActiveDocument
strReturnValue = objImpRep.GetDataValue(1,1)
Set objImpRep = objImpApp.OpenReport("c:\reports\ABC Report.imr",strReturnValue)
Set objImpRep = Nothing
Set objImpApp = Nothing
End Sub
I get error on the ActiveDocument line.
The question is how do I resolve this. I need to run the main report which prompts me for input but then the macro fails.
Any help will be highly appreciated.
Thanks,
Ashish