ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Page break in normal view set at startup (https://www.excelbanter.com/excel-discussion-misc-queries/43982-page-break-normal-view-set-startup.html)

Stephen S

Page break in normal view set at startup
 
Excel 2003. Is it possible to have Excel with Tool/Options/View/Page Break
always set at startup.

HiArt


Hi Stephen,

try adding the following VBA code to the workbook


Code:
--------------------
Sub Auto_Open()
ActiveSheet.DisplayAutomaticPageBreaks = True
End Sub

--------------------


HTH

Art


--
HiArt
------------------------------------------------------------------------
HiArt's Profile: http://www.excelforum.com/member.php...o&userid=19953
View this thread: http://www.excelforum.com/showthread...hreadid=402065


Dave Peterson

Do you mean for a particular workbook or for all workbooks?

If you mean a particular workbook, you could use a macro like:

Option Explicit
Sub auto_open()

Dim wks As Worksheet
Dim ActCell As Range

Set ActCell = ActiveCell

For Each wks In ThisWorkbook.Worksheets
wks.Select
ActiveWindow.View = xlPageBreakPreview
Next wks

Application.Goto ActCell
End Sub



======

If you mean everytime you open a workbook (or create a new workbook????), you
could tie into an application event.

Start a new workbook
paste the code into the ThisWorkbook Module
Back to excel and File|SaveAs
Save it to a nice location, but as an Addin (use that dropdown at the bottom of
the file|saveas dialog).

Close excel
reopen excel
tools|addins|Browse for that addin you just created.

You can always disable/re-enable it via the tools|addins menu.

The code under the ThisWorkbook module:

Option Explicit
Public WithEvents xlApp As Excel.Application
Private Sub Workbook_Open()
Set xlApp = Application
End Sub
Private Sub Workbook_Close()
Set xlApp = Nothing
End Sub
Private Sub xlApp_NewWorkbook(ByVal wb As Workbook)
Call DoTheWork(wb)
End Sub
Private Sub xlApp_WorkbookOpen(ByVal wb As Workbook)
Call DoTheWork(wb)
End Sub
Sub DoTheWork(wb As Workbook)

Dim wks As Worksheet
Dim ActCell As Range

Set ActCell = ActiveCell

For Each wks In wb.Worksheets
wks.Select
ActiveWindow.View = xlPageBreakPreview
Next wks

Application.Goto ActCell
End Sub


If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

You can read a lot more about application events at Chip Pearson's site:
http://www.cpearson.com/excel/AppEvent.htm


Stephen S wrote:

Excel 2003. Is it possible to have Excel with Tool/Options/View/Page Break
always set at startup.


--

Dave Peterson

SAHAJA

Page break in normal view set at startup
 

Do you think I could get a copy of your laser quoting file.


--
SAHAJA
------------------------------------------------------------------------
SAHAJA's Profile: http://www.excelforum.com/member.php...o&userid=33517
View this thread: http://www.excelforum.com/showthread...hreadid=402065



All times are GMT +1. The time now is 09:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com