PDA

View Full Version : Exporting Multiple Summaries



Gareth Horton
July 12th, 2002, 02:42 PM
One little change to your code and it'll make it more versatile:
Dim intSumCnt as Integer
intSumCnt = MonarchObj.SummaryCount

'Change the line
> For x = 1 To 5
For x = 1 To intSumCount

Now, you don't have to change the code when you apply it with different summary counts.

Just my $0.02 worth.

Mark Huston wrote:
> Doug Voss wrote:
> > I have a need to export several tabs in one go - I have tried to select several tabs in my summary view and then export to say excel, but only the first one is being exported - I am using Monarch version 5.02 pro. Can anyone help???
> ++++++++++++++++++++
> Doug, here’s a workaround. It makes use of a structure I use to apply different models to one report. What you can do is take your model with the different summary tabs, activate a different summary, then save the model as a different model. This structure assumes that, with five different summaries, you’d save them as MultSumModel_1.mod, MultSumModel_2.mod, MultSumModel_3.mod, etc.
>
> This code then applies each model in turn, and exports the summary that’s active in each of the models.
>
> Obviously, the folks at Datawatch noticed that this is kind of a retarded way to export multiple summaries, so in V6 you can export all the summaries at once. Which, of course, would be the ideal solution. But sometimes the workaround, if it works and isn’t too labor-intensive, can get you by.
>
> Hope this helps,
> Mark!
>
> ++++++++++++++++++
> << Option Explicit, variables dimmed >>
>
> Sub Mult_Summary_Monarch()
>
> ModPath = "C:YourModelDirectory"
> DestPath = "C:YourOutputDirectory"
> ChDrive "C"
> ChDir "YourReportDirectory"
>
> RptPathName = Application.GetOpenFilename _
> ("All files (*.*), *.*", , _,$s:LF> "Select the report you want to export multiple summaries from.")
> If RptPathName = False Then End
>
> Set MonarchObj = GetObject("", "Monarch32")
> If MonarchObj Is Nothing Then
> Set MonarchObj = CreateObject("Monarch32")
> End If
> t = MonarchObj.SetLogFile("C:MPrg_G5.log", False)
> OpenFile = MonarchObj.SetReportFile(RptPathName, False)
>
> If OpenFile = True Then
> For x = 1 To 5
> ModFile = ModPath & "MultSumModel_" & x & ".mod"
> DestFile = DestPath & "Summary_" & x & ".xls"
> OpenMod = MonarchObj.SetModelFile(ModFile)
> If OpenMod = True Then
> 'Export the active summary to Excel
> MonarchObj.SetFirstView (t)
> MonarchObj.ExportSummary (DestFile)
> End If
> Next x
> End If
> End Sub
>
>