2 Replies Latest reply: May 15, 2014 9:56 AM by Tom2 _ RSS

    SetProjectFile vs. SetReportFile

    Tom2 _

      A project file I created has 30 dated files associated with it.  In VBA when I set this project it opens all 30 reports.  I then load SetReportFile with an "empty" report with the FALSE method.  I am doing this to keep the project open so that when I load 30 new dated files I can RunAllExports.  Is there an error in my logic that I CAN set a project file, then set and empty file AND still RETAIN the project?

       

      This may look suspiciously familiar! Many thanks to those who post here.

       

       

      'Get Report Files

      strPath = "C:Documents and Settings     bredvickDesktopATMReportsDaily     est"

      strFile = Dir(strPath & "netsdaily2006*")

      Do While strFile <> ""

          OpenFile = objMonarch.SetReportfile(strPath & strFile, True)

          If OpenFile = False Then

              MsgBox "Error Opening File: " & strFile

      '       Exit Sub

          End If

          strFile = Dir()

      Loop

       

      ExportSuccess = objMonarch.RunAllExports()

       

      objMonarch.CloseAllDocuments

      objMonarch.Exit

        • SetProjectFile vs. SetReportFile
          Tom2 _

          Sorry... posted from first "test code" but here is what I am ACTUALLY working on...

           

          'Set project file & empty reports

          OpenProject = objMonarch.SetProjectFile("C:Documents and Settings     bredvickDesktopATMReportsATMReports.xprj")

          OpenEmptyFile = objMonarch.SetReportfile("C:Documents and Settings     bredvickDesktopATMReportsempty.txt", False)

           

          'Get Report Files

          strPath = "C:Documents and Settings     bredvickDesktopATMReportsDaily     est"

          strFile = Dir(strPath & "netsdaily*")

          Do While strFile <> ""

              OpenFile = objMonarch.SetReportfile(strPath & strFile, True)

              strFile = Dir()

          Loop

          ExportSuccess = objMonarch.RunAllExports()

          End Sub

          • SetProjectFile vs. SetReportFile
            Tom2 _

            Sorry... should have tried this first.

            1.  Build model using reports.

            2.  Load "empty.txt" and unload all reports.

            3.  Save project file.

             

            Then I can set the project file and loop through my reports.  Many posts hinted to processing by directory or by variable passed to loop but the above works.