BusinessObjects Board

out of memory

I’ve developed this groovy little VBA add-in that saves out a single report to multiple pdf files with different report tabs in each file. Fabulous. It worked wonderfully until I tried it on a big report. Now I’m getting an out of memory error.

The macro repeatedly opens the report, deletes unwanted report tabs, and does a save as.

I am far from the a VBA expert… I know what I know when I need to know it. Are there any generic tips on reduce what’s in memory or am I out of luck because it’s the fault of the size of the report?

Hope this question makes sense… :?


JennFisher :us: (BOB member since 2002-06-25)

Hi Jen,

Maybe you are chewing up a lot of memory by repeatedly opening the report? Can you open the report just once and then “split up” the report to different PDF files?

Judy


JMulders :us: (BOB member since 2002-06-20)

Good question. The reason I keep opening the report is because I delete report tabs, do a save as, and then I need those deleted report tabs back. Hmm… is there another way? :confused:


JennFisher :us: (BOB member since 2002-06-25)

Do you have access to the KX? If you do, I believe Resolution #5270 may be exactly what you are looking for. I found it last week when I was looking at saving PDFs using JSP.


Eileen King :us: (BOB member since 2002-07-10)

Thanks for the tip. I’ve got the code to save the report. The problem I have is that the report file has 3 report tabs… report1, report2, and report3. I want to create PDF1 with report1 and report2 and PDF2 with report2 and report3.

To do this, I open the .rep file, delete report3, save as PDF1, close .rep file without saving, open .rep file, delete report1, save as PDF2, clode .rep file without saving, etc…

Works fine with small reports. Runs out of memory on bigger ones.

:frowning:


JennFisher :us: (BOB member since 2002-06-25)

Won’t this step through the process and create one PDF for each tab? That way you would only have to open it once, create all of the tabs, and then close it…

For x = 1 To Doc.Reports.Count
Set Rep = Doc.Reports.Item(x)
Rep.ExportAsPDF ("C:\" & Rep.Name)
Next x

Eileen King :us: (BOB member since 2002-07-10)

Thanks for the suggestion. Is there a way to do this to save multiple report tabs, though? That’s where it’s gettin’ tricky for me…

:hb:


JennFisher :us: (BOB member since 2002-06-25)

Like I said I’m not a VB expert by any means and just kind of teach myself along the way. But I sat down and watched my memory usage as my code ran and saw with each document close (without save) then immediate document open my available memory kept slipping. When I did this manually, it was fine.

So I stuck a 2 second pause in between the close and the open and, while I’m still testing on a MONSTER report, it looks like it did the trick!

So, I don’t know if I actually fixed it, or if this is just a little weird nuance, but it appears that my issue has, well, disappeared.

Of course, we are running unsupported on Windows 95 with BO 5.1.4 so who knows how long this will work…


JennFisher :us: (BOB member since 2002-06-25)