View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default return to xlnormalview problem

The code that you posted is operating properly as written. The variable
ViewMode is set to the pagebreak view which displays with the shaded area.
Then the xlNormalView is returned for the active sheet, which is the new
added sheet. To return the original ActiveSheet to the xlNormalView, Try
this:


Sub Macro1()
Dim ViewMode As Long
ActiveSheet.Select
shNm = ActiveSheet.Name
Range("A1") = 1
Range("D20") = 1
ActiveWindow.View = xlPageBreakPreview
ActiveSheet.Copy AFTER:=ActiveSheet
With ActiveSheet
.Select
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
End With
Sheets(shNm).Activate
ActiveWindow.View = xlNormalView
End Sub






"mrLee" wrote:

hi,office developers.

i have this macro just for test.
but not return to xlnormalview on the copied sheet.
i'd very appreciated for any comments what the problem with below macro.
thanks in advance.

Sub Macro1()
Dim ViewMode As Long
ActiveSheet.Select
Range("A1") = 1
Range("D20") = 1
ActiveWindow.View = xlPageBreakPreview
ActiveSheet.Copy AFTER:=ActiveSheet
With ActiveSheet
.Select
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
End With
ActiveWindow.View = ViewMode
End Sub