PSS ID Number: 132219
Article Last Modified on 7/10/2001
The information in this article applies to:
- Microsoft Excel for Windows 95
- Microsoft Visual Basic for Applications
This article was previously published under Q132219
SUMMARY
When you run a Visual Basic, Applications Edition, macro that uses the Report Manager add-in and the Report Manager has not previously been opened, the macro runs without error but does not print the report.
MORE INFORMATION
To access a closed Report Manager add-in, open the Report Manager add-in from a Visual Basic for Applications macro, and then use an OnTime function to call a second Visual Basic for Applications macro that runs the Report Manager.
Sample Visual Basic Code
Microsoft provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose.
The following code will print using the Report Manager Add-In even if the Add-In is closed at the time the macros are run:
Sub Test_Print() Dim LibPath As String ' Record the path to the Excel Libraries LibPath = Application.LibraryPath & "\REPORTS.XLA" ' Open the REPORTS.XLA file. Workbooks.Open(Filename:=LibPath).RunAutoMacros _ Which:=xlAutoOpen ' Set up an "OnTime macro that will run the ' "Print_Report" macro as soon as the ' "Test_Print" macro completes. Application.OnTime Now, "Print_Report" End Sub Sub Print_Report() ' Report Managers Report.Print should now work correctly. Application.ExecuteExcel4Macro String:= _ "REPORT.PRINT(""TestPrint"",1)" End Sub
Keywords: kbcode kbprb kbProgramming KB132219
Technology: kbExcel95Search kbExcelSearch kbExcelWinSearch kbVBASearch kbZNotKeyword3 kbZNotKeyword6