Refresh report giving automatically a range date

Hello,

I never used Visual Basic before but I have to do to schedule a Business Object 5.1.5 report and export the result.

At the moment I found how open a report with credentials using command prompt and how to save and close the report using a macro.


Private Sub Document_Open()
    Dim Doc As Document
    Dim Rep As Report
    
    Set Doc = Application.Documents.Item(1)
    Doc.Refresh

Now I saw that by with the code above displays the dialog box where I can insert the range of data that I need. Is there anyway to pass this range automatically? I have 4 reports and 3 of these I need to refresh the report with the day before date instead in one report I’ve to take the date from another program wrote in C#.

After refreshing I saw that Doc.Save and Doc.Close I can save and close the report. In the Middle of these operation I want to export the results in and Excel file but I haven’t command like Rep.ExportAsExcel.

Can you help me? Thank you and sorry for my bad English.


y.chen (BOB member since 2012-06-18)

Welcome to B:bob:B!

[quote:9145c37bc2=“y.chen”]I want to export the results in and Excel file but I haven’t command like Rep.ExportAsExcel.
[/quote]
You are using VERY old version of Business Objects, more than 10 years old version. The export to excel feature was not available in that version. It first became available in the version 6.

Time to upgrade to more recent BO version.


Marek Chladny :slovakia: (BOB member since 2003-11-27)

Thank you! :smiley:

It’s a complicated situation. We are not the owners the program. Another society provided Business Object to us and then we can’t choose to upgrade.

But the export in Excel is not a problem if I can export in a no dos notepad file. After I will modify the program that loads the report in a database.

But with this version can I automatically refresh and export a report giving automatically a date range like yesterday or today or reading the dates from something like a notepad file?

Thank you


y.chen (BOB member since 2012-06-18)

[quote:6705631d4d=“y.chen”]It’s a complicated situation. We are not the owners the program. Another society provided Business Object to us and then we can’t choose to upgrade.
[/quote]
That’s odd that the company provided you with 10+ years old and unsupported version of a software.

[quote:6705631d4d=“y.chen”]can I automatically refresh and export a report giving automatically a date range like yesterday or today…?
[/quote]
You would need to change the WHERE conditions in the underlying SQL statement(s) to use SYSDATE for Oracle or CurrentDate() for other databases.


Marek Chladny :slovakia: (BOB member since 2003-11-27)

I don’t know what to say… Anyway it’s a public company that manages all the system and the databases, they provided Business Object to the company where I work. We fought more than one year to have the macro menu.

So you say that we need to know the database structure for schedule the report refresh? No other ways?

Thank you.


y.chen (BOB member since 2012-06-18)

I found how to set the range date but with Doc.Refresh I get always the dialog box that ask to insert it and press OK.

How can I automatically refresh with the setted range?

Thank you.


y.chen (BOB member since 2012-06-18)