Microsoft KB Archive/132219

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

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 & &quot;\REPORTS.XLA&quot; ' Open the REPORTS.XLA file. Workbooks.Open(Filename:=LibPath).RunAutoMacros _ Which:=xlAutoOpen

' Set up an &quot;OnTime macro that will run the ' &quot;Print_Report&quot; macro as soon as the ' &quot;Test_Print&quot; macro completes.

Application.OnTime Now, &quot;Print_Report&quot; End Sub

Sub Print_Report ' Report Managers Report.Print should now work correctly.

Application.ExecuteExcel4Macro String:= _ &quot;REPORT.PRINT(&quot;&quot;TestPrint&quot;&quot;,1)&quot; End Sub

Keywords: kbcode kbprb kbProgramming KB132219

Technology: kbExcel95Search kbExcelSearch kbExcelWinSearch kbVBASearch kbZNotKeyword3 kbZNotKeyword6

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2003 Microsoft Corporation. All rights reserved.