View Single Post
  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

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