Beginner2009
MIS
I would like to run impromptu report from excel, is it possible? if yes can someone tell me how to do it as I am not very familiar with VBA.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub ExtractOvrDrfts()
On Error GoTo Err_Impromptu
Dim objAuthApp As Object
Dim objAuthDoc As Object
Dim objImpromptu As Object
Dim objReport As Object
Const TheCatalog As String = "S:\Cognos\Impromptu\Catalog\Mart.cat"
Const Report_Folder="L:\"
Const TheReport As String = "MonthlyData.imr"
Const TheUserClassID As String = "xxxAdministrators"
Const TheUserName As String = "xxxxxx"
Const TheUserPassword As String = "xxxxxxxxx"
Const TheExportedFile As String = "MonthlyData.txt"
Dim TheDate As String
TheDate = Format(DMax("Formalised", "Ecl1", "CurMonth=True"), "yyyy-mm-dd")
'Runtime version of Cognos Access Manager cannot create the following objects to log on to the database automagicaly
'Set objAuthApp = CreateObject("Authenticator2.Application")
'Set objAuthDoc = objAuthApp.Documents.OpenWithBasicSignon("Default", TheUserName, TheUserPassword, TheUserClassID)
Set objImpromptu = CreateObject("CognosImpromptu.Application")
objImpromptu.Visible True
objImpromptu.OpenCatalog TheCatalog ' , TheUserClassID, , , , 1 'Using Cognos Access Manager
objImpromptu.Visible False
Set objReport = objImpromptu.OpenReport(Report_Folder & TheReport, TheDate)
objReport.RetrieveAll
If Dir(Report_Folder & TheExportedFile) <> "" Then Kill Report_Folder & TheExportedFile
objReport.ExportASCII Report_Folder & TheExportedFile, True, False, ";"
objReport.CloseReport
objImpromptu.Quit
'objAuthDoc.Close
'objAuthApp.Quit
Exit_Impromptu:
Set objReport = Nothing
Set objImpromptu = Nothing
' Set objAuthDoc = Nothing
' Set objAuthApp = Nothing
Exit Sub
Err_Impromptu:
MsgBox Err.Number & ": " & Err.Description
Resume Exit_Impromptu
End Sub
So I just open the catalog'Runtime version of Cognos Access Manager cannot create the following objects to log on to the database automagicaly
'Set objAuthApp = CreateObject("Authenticator2.Application")
'Set objAuthDoc = objAuthApp.Documents.OpenWithBasicSignon("Default", TheUserName, TheUserPassword,
objImpromptu.OpenCatalog TheCatalog
Set objImpRep = CreateObject("Impromptu.Application")
objImpApp.OpenCatalog strCatalog, strCatalogUserId