XL: Sample Macro to Set Print Titles in Active WorksheetLast reviewed: January 7, 1998Article ID: Q141093 |
The information in this article applies to:
SUMMARYIn Microsoft Excel, if you want to set print titles for a worksheet, you must use the Page Setup dialog box to enter range references. The steps and macro in the "More Information" section of this article allow you to use a custom dialog box to set these page attributes.
MORE INFORMATIONMicrosoft provides programming examples 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 article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/refguide/default.asp To create the custom dialog box
To create the macroIn your Personal Macro workbook, insert a new module sheet, and enter the following code in the module sheet:
Sub Set_Print_Titles() With DialogSheets("titles") 'If the user presses Cancel in the Dialog box, then the two lines 'of code below the ".Show" method are not executed If .Show Then 'The following two lines will set Print Titles to the ranges 'that are in the two edit boxes on the dialog sheet. 'If the edit boxes are empty, then Print Titles are cleared. ActiveSheet.PageSetup.PrintTitleRows = _ .EditBoxes("rowrange").Text ActiveSheet.PageSetup.PrintTitleColumns = _ .EditBoxes("colrange").Text End If End With End Sub To add the macro to a custom toolbar button
To use the macro
ARTICLE-ID: Q121401 TITLE : XL: Setting Print Area and Print Titles on Worksheet REFERENCES"Visual Basic User's Guide," version 5.0, Chapter 11, "Controls and Dialog Boxes"
|
Additional query words: 5.00 5.00a 5.00c 7.00 7.00a XL7 XL5
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |