Dim ImpAppObject as Object Dim ImpRepObject as Object Dim RepName as String Dim CatName as String Dim NumberOfRuns as Integer Dim NumberOfPromts as Integer Dim RunNumberCounter as Integer Dim PromptNumberCounter as Integer Dim PromptString as String Dim RepPrompts() as String Dim CatUserName as String Dim CatPassword as String Declare Sub CreateVariables (NumberOfPrompts as Integer, NumberOfRuns as Integer) Sub Main() '******************************************************************* ' Begin User Serviceable Area '******************************************************************* 'Enter the full path to the report here RepName = "O:\Impromtu\Reports\Actual Summary by Dept.imr" 'Enter the full path to the corresponding catalog here CatName = "O:\Impromtu\Catalogs\General Ledger.cat" 'Replace 3 in the next line with the number of times the report will be run. NumberOfRuns = 3 'Replace 2 in the next line with the number of prompts in the report NumberOfPrompts = 2 'Do not change the next line! Call CreateVariables (NumberOfPrompts, NumberOfRuns ) 'The following section is of the format: ' RepPrompts( Report Run Number, Prompt Number) 'Add additional / delete lines as necessary to complete all the prompts for ' the report RepPrompts ( 1, 1) = "2000" 'First run first prompt RepPrompts ( 1, 2) = "01" 'First run second prompt RepPrompts ( 2, 1) = "2000" 'Second run first prompt RepPrompts ( 2, 2) = "11" 'Second run second prompt RepPrompts ( 3, 1) = "2000" 'Third run first prompt RepPrompts ( 3, 2) = "04" 'Third run second prompt etc. '******************************************************************* ' END User Serviceable Area '******************************************************************* Set ImpAppObject = CreateObject("CognosImpromptu.Application") 'Set ImpRepObject = CreateObject("CognosImpromptu.Report") CatUserName = InputBox("What is your Costpoint username?", "Login Username") CatPassword = PasswordBox("What is your Costpoint password?", "Login Password") ImpAppObject.Visible 1 ImpAppObject.OpenCatalog CatName, "SuperUser",,CatUsername, CatPassword, 1 For RunNumberCounter = 1 to NumberOfRuns 'Lets Create the prompt string for this run PromptString = "" For PromptNumberCounter = 1 to NumberOfPrompts PromptString = PromptString + RepPrompts(RunNumberCounter, PromptNumberCounter) + "|" Next PromptNumberCounter Set ImpRepObject = ImpAppObject.OpenReport ( RepName, PromptString ) ImpRepObject.Print ImpRepObject.CloseReport Set ImpRepObject = Nothing Next RunNumberCounter ImpAppObject.Quit Set ImpRepObject = Nothing Set ImpAppObject = Nothing MsgBox "All reports have been printed",0,"Processing Complete" End Sub Sub CreateVariables (NumberOfPrompts as Integer, NumberOfRuns as Integer) ReDim RepPrompts(NumberOfRuns, NumberOfPrompts) as String End Sub