XL: Macro Does Not Open Report Manager Add-In as Expected

Last reviewed: September 3, 1997
Article ID: Q132219
The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0, 5.0c

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


Additional query words:
Keywords : kbcode kbprg PgmOthr
Version : 5.0 5.0c 7.0
Platform : WINDOWS
Issue type : kbprb
Solution Type : kbcode


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 3, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.