Quantcast
Channel: All Quality Center / ALM Practitioners Forum posts
Viewing all articles
Browse latest Browse all 14708

Re: Automatically create Excel Reports and store them in a folder

$
0
0

Hi MichaelMotes and the rest of the community members.

 

I developed a VBA code to generate dashboard standard reports automatically. I get the "successfull exception" you have mentioned. However my report does not get generated in my hard disk.

 

I don´t get any errors. 

I have adapted your Visial Basic Code to VBA using OTA. I have the otareport 1.0 Type Library and otaxml type lib registered in the  tools/reference option in the VBA module window.

 

I am pasting my code below hoping you guys can give me some insight on this. I am not getting any errors. Just the exception which includes a successfull completion message. Thanks in Advanced

 

Sub externalSTDReports()

 

 Dim reqFact  

Dim reqFilter  

Dim reqList      

Dim gTDConn As Object  

 

Set gTDConn = CreateObject("TDApiOle80.TDConnection")

 

 'QC Connection data    

 

login_id = ActiveWorkbook.Sheets("CONFIG").Cells(9, 3).value  

login_passwd = ActiveWorkbook.Sheets("CONFIG").Cells(10, 3).value  

domain_name = ActiveWorkbook.Sheets("CONFIG").Cells(11, 3).value  

project_name = ActiveWorkbook.Sheets("CONFIG").Cells(12, 3).value  

server_name = ActiveWorkbook.Sheets("CONFIG").Cells(13, 3).value            

 

gTDConn.InitConnectionEx server_name      

gTDConn.login login_id, login_passwd      

gTDConn.Connect domain_name, project_name

 

                       Set Rep = New OTAREPORTLib.Reporter            

                      Call Rep.SetConnection(gTDConn, 0)     ' This line  doesn´t return errors. But I don´t know if it is correct                      

                     Set RepConf = Rep.ReportConfig                        

                    Rep.File = "C:\Users\cris\AppData\Local\Temp\TD_80\4c223b57\Reports\std.html"            

                    Rep.Template = "C:\Users\cris\AppData\Local\Temp\TD_80\4c223b57\Reports\default.xsl"

'******************************************************** filter Reports    

 

   Set aiFact = gTDConn.AnalysisItemFolderFactory  

   Set reportFact = gTDConn.AnalysisItemFactory

  Set aiFilter = aiFact.Filter  

  Set aiList = aiFilter.NewList  

  Set anf = reportFact.Filter  

   

     Dim FilterStr As String       

 

    For Each ai In anf.NewList            

 

    reportName = ai.Name       

   reportID = ai.id           

 

   If reportName = "tmp" Then                 

 

     FilterStr = ai.Field("AI_FILTER_DATA")             

     RepConf.Filter = FilterStr                

 

   On Error Resume Next                

 

    'i is empty. Don´t know why

 

    i = Rep.Generate(0, 0)                 MsgBox i & " --- " & Rep.File         Debug.Print Rep.File      '--------------------         Exit For      

  End If           

 

Next

            

              Set gTDConn = Nothing   

             Set aiFact = Nothing   

             Set reportFact = Nothing

           Set aiFilter = Nothing     

          Set aiList = Nothing    Set anf = Nothing

         Set RepConfig = Nothing

         Set Rep = Nothing          

 

       MsgBox "END "

 

End Sub    'Pls HELP!!

 


Viewing all articles
Browse latest Browse all 14708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>