VBA/Excel/Access/Word/Application/ActiveWindow

Материал из VB Эксперт
Перейти к: навигация, поиск

Changing the View

   <source lang="vb">

"ppViewHandoutMaster, ppViewMasterThumbnails, ppViewNormal, ppViewNotesMaster, ppViewNotesPage, ppViewOutline, ppViewPrintPreview, ppViewSlide, ppViewSlideMaster, ppViewSlideSorter, ppViewThumbnails, or ppViewTitleMaster. Sub view()

   ActiveWindow.ViewType=ppViewSlideSorter

End Sub

</source>
   
  


Get the Usable Height and Width

   <source lang="vb">

Sub GetActiveWindowUsableHeightWidth()

   MsgBox ActiveWindow.UsableHeight
   MsgBox ActiveWindow.UsableWidth

End Sub

</source>
   
  


Opening a New Window

   <source lang="vb">

Sub newWindow()

   ActiveWindow.NewWindow

End Sub

</source>
   
  


Positioning and Sizing a Window: set its Left and Top properties

   <source lang="vb">

Sub pos()

   ActiveWindow.Left = 100
   ActiveWindow.Top = 200

End Sub

</source>
   
  


scrolls the active window up two screens

   <source lang="vb">

Sub scroll()

   ActiveWindow.LargeScroll Up:=2

End Sub

</source>
   
  


Splitting a Window 70 percent of the way down the window:

   <source lang="vb">

Sub split()

   With ActiveWindow
       .Split = True
       .SplitVertical = 70
   End With

End Sub

</source>
   
  


To display the Document Map for a window at the Document Map"s previous width percentage (of the document"s window), set the DocumentMap property to True:

   <source lang="vb">

Sub map()

   ActiveWindow.DocumentMap = True

End Sub

</source>
   
  


Toggle Gridlines

   <source lang="vb">

Sub ToggleGridlines()

   ActiveWindow.DisplayGridlines = Not ActiveWindow.DisplayGridlines

End Sub

</source>
   
  


Toggle Headings

   <source lang="vb">

Sub ToggleHeadings()

   ActiveWindow.DisplayHeadings = Not ActiveWindow.DisplayHeadings

End Sub

</source>
   
  


To remove the split from the window, set the Split property to False:

   <source lang="vb">

Sub remove()

   ActiveWindow.Split = False

End Sub

</source>
   
  


To size a window, set its Height and Width properties:

   <source lang="vb">

Sub size()

   With ActiveWindow
       .Height = 300
       .width = 400
   End With

End Sub

</source>
   
  


Working with Panes

   <source lang="vb">

Sub pane()

   With ActiveWindow
       .ViewType = ppViewSlide
       .Panes(1).Activate
   End With

End Sub

</source>
   
  


Zooms the active window to 150 percent:

   <source lang="vb">

Sub zoom()

   ActiveWindow.View.Zoom = 150

End Sub

</source>