Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using saveas in business objects

Status
Not open for further replies.

funkmonsteruk

IS-IT--Management
Feb 8, 2002
210
GB
I've just set up some reports in BO 5.1.3 to run automatically overnight. I was given some code to acheive this and i have been using this facility to update information on an iternet page, this is how the code looks at the moment

Dim Doc as Document
Dim Rep as Report

Set Doc = Application.Documents.Item(1)
Doc.Refresh
Doc.Save
Set Rep = Doc.Reports.Item(1)
Rep.ExportAsHtml ("F:\Public\Probate Intranet\Account Balances Report")

Application.Quit

I now need this report to do two more things: Firstly i need it to save as and use the date it was produced as part of the document name (eg AccountBalances_29/08/2002). The secound thing i need to do is automatically print the report, i have tried Doc.Printout underneath the Doc.Save line but this only works if i step through the code and not if i include it in a document open routine.

Can anyone help me with this problem?
 
To save with a diferent name
[tt]
'Uncomment the date you prefer
Dim MyDate as Date
'MyDate = Date '(current date)
'MyDate = Doc.LastSaveDate
'MyDate = Doc.DataProviders(N).LastExecutionTime
Rep.ExportAsHtml "F:\Public\Probate Intranet\Account Balances Report_" + Format(MyDate, "yyyy-mm-dd")
[/tt]
Where [tt]N[/tt] is the index of the a refreshable data provider used in the report, for example, 1.

Note that you can't use "/" nor "\" in a filename.

To print the report

Doc.PrintOut prints the report using the current view type, either normal view or structure view. ensure you are in normal view before calling Doc.PrintOut.

If you own Adobe Acrobat, you could export the report as PDF and then use the Acrobat library for VBA to print it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top