Dharma Records

A record of Ānandajoti’s publication work.

Menu
  • Notices
  • Talks
  • Texts
  • Audio
  • Video
  • Photos
  • Ecology
  • Culture
  • Archives
  • About
Menu

MS Word: Split Windows Vertically

Posted on October 5, 2013October 5, 2013 by Ānandajoti

Microsoft’s Winword provides a facility to split the screen of the active document horizontally, but not vertically.

I searched for a way to do this on the Net, and was surprised when I couldn’t find one, so I wrote a macro myself.

It doesn’t split in exactly the same way as the horizontal split works, but it is effective.

The VBA macro takes the active window, makes it two, and then arranges them side by side.

I have annotated the code so it can be easily read and modified, which you are allowed to do (GNU).

The code splits the window into equal halves, but with some small adjustments could split it 1/3-2/3 or any other dimensions you require.

The code was only tested in Word 97 and Word 2007.


Sub SplitVertically()

' script by Anandajoti (GNU license)
' this macro takes the active window makes it two
' and then arranges them side by side
' if the active window is already duplicated
' it closes the duplicate instead

Dim Win1 As Integer
Dim Win2 As Integer

Dim WinWidth As Integer
Dim WinHeight As Integer

' the first part is a toggle function
' it looks to see if there are windows
' that have already been duplicated
' and if there are it closes the 2nd
' and maximises the first
' and then exits

' if you don't want/need this part delete up to "Next Win"

Dim Win As Word.Window
Dim DocString As String
Dim FirstString
Dim SecondString
Dim StringLength As Long

For Each Win In Application.Windows
DocString = Win
FirstString = Right(DocString, 1)

    If FirstString = "1" Then
    
' if there is a duplicate
    
    StringLength = Len(DocString) - 2
    SecondString = Left(DocString, StringLength)
    
' close the copy

    Windows(SecondString & ":2").Close
    
' activate and maximise the doc that was found

    Windows(Win).Activate
    Windows(Win).WindowState = wdWindowStateMaximize
    
' jump to the end

    GoTo TheEnd
    
    End If

' otherwise check the next window

Next Win

' if there are no duplicates
' make sure the window is maximised
' so we can get the necessary dimensions
' the view it is in is unimportant

    ActiveWindow.WindowState = wdWindowStateMaximize

' find the serial number of the window
' we are dealing with and set the variable

    Win1 = ActiveWindow.Index

' set the dimension variables

    WinHeight = ActiveWindow.Height - 20
    WinWidth = ActiveWindow.Width

' make a new window from the first

    NewWindow

' find the serial number of the new window
    
    Win2 = ActiveWindow.Index
    
' arrange all windows (it won't work if the window is maximised)

    Windows.Arrange

' set the size of the two windows we found

    With Windows(Win1)
        .Left = 0
        .Top = 0
        .Height = WinHeight
        .Width = WinWidth / 2
    End With
    
    With Windows(Win2)
        .Left = WinWidth / 2
        .Top = 0
        .Height = WinHeight
        .Width = WinWidth / 2
    End With
   
' return to the first window

    Windows(Win1).Activate
    
TheEnd:
        
End Sub

or if you would prefer without annotation:


Sub SplitVertically()
Dim Win1 As Integer
Dim Win2 As Integer
Dim WinWidth As Integer
Dim WinHeight As Integer
Dim Win As Word.Window
Dim DocString As String
Dim FirstString
Dim SecondString
Dim StringLength As Long
For Each Win In Application.Windows
DocString = Win
FirstString = Right(DocString, 1)
    If FirstString = "1" Then
    StringLength = Len(DocString) - 2
    SecondString = Left(DocString, StringLength)
    Windows(SecondString & ":2").Close
    ws(Win).Activate
    Windows(Win).WindowState = wdWindowStateMaximize
       GoTo TheEnd
    End If
Next Win
    ActiveWindow.WindowState = wdWindowStateMaximize
    Win1 = ActiveWindow.Index
    WinHeight = ActiveWindow.Height - 20
    WinWidth = ActiveWindow.Width
    NewWindow
    Win2 = ActiveWindow.Index
    Windows.Arrange
    With Windows(Win1)
        .Left = 0
        .Top = 0
        .Height = WinHeight
        .Width = WinWidth / 2
    End With
    With Windows(Win2)
        .Left = WinWidth / 2
        .Top = 0
        .Height = WinHeight
        .Width = WinWidth / 2
    End With
    Windows(Win1).Activate
TheEnd: 
End Sub

If anyone can improve on the coding (and I wouldn’t be surprised) please leave a comment.

I hope this will be useful to others.

 

Split MS Word Screen Vertically

1 thought on “MS Word: Split Windows Vertically”

  1. Graham says:
    October 25, 2013 at 5:29 pm

    Anandajoti,

    Greetings from London, and thank you for this wonderful little macro – it’s just what I was looking for! If it’s of any interest, your page was one of the first to be listed by DuckDuckGo for the search query: “word 2007” arrange windows vertically

    Gratefully, Graham

Leave a Reply

Your email address will not be published. Required fields are marked *

QR code

SHORTLINK

Donations

there are many expenses involved in the making of this website. Even a small donation really helps to maintain and expand the site.

Recent Posts

  • Dhammanīti, Dhamma Wisdom Published
  • Childers’ On Sandhi in Pali Published
  • Checkboxes for Long Works on Ancient Buddhist Texts
  • Dharma Storybooks on Photo Dharma
  • The Exalted Chapters, A Simplified Translation of the Udānavarga
  • Translation of the Sanskrit Udānavarga Published
  • The Lives of Inspiring Chinese Nuns
  • Five New Albums on Photo Dharma
  • Henri van Zeyst’s Contributions to the Sri Lankan Encyclopedia of Buddhism
  • The Reliefs of Buddhavanam eBook Published

Top Ten Tags

Buddha

Dhamma

Sangha

India

China

Indonesia

Thailand

Temples

Wisdom

Ethics

Other Websites

for my other websites please see my
LINKTREE

Sponsorship

 hosting sponsored by exabytes.my 

Random Posts

  • Video of Murals in Viharn Lai Kham, Wat Phra Singh, Chiang Mai
  • Lanna Orchid Ensemble of Chiang Mai University
  • Appeal for Victims of Cyclone Giri
  • Geography of Early Buddhism by B C Law Published
  • Bhante Guttasīla remembers Ven. Ñāṇavimala (Transcript)
  • Days, Months and Seasons in Pali
  • Introduction to The Silk Road Series
  • Rāma’s Story on the Prambanan Reliefs Published
  • Why the Buddha Suffered
  • BWV 001: One should be Amenable to Admonition

Recent Posts

  • Dhammanīti, Dhamma Wisdom Published
  • Childers’ On Sandhi in Pali Published
  • Checkboxes for Long Works on Ancient Buddhist Texts
  • Dharma Storybooks on Photo Dharma
  • The Exalted Chapters, A Simplified Translation of the Udānavarga
  • Translation of the Sanskrit Udānavarga Published
  • The Lives of Inspiring Chinese Nuns
  • Five New Albums on Photo Dharma
  • Henri van Zeyst’s Contributions to the Sri Lankan Encyclopedia of Buddhism
  • The Reliefs of Buddhavanam eBook Published

Related Posts:

  • Facebook Comments: Dynamic Urls on Static Pages
  • Resize images to Fit Browser Window
  • Virtual Desktops and Dual Monitors
  • Photo Dharma now supports Tablets and Phones
  • Making short urls using javascript and a .htaccess file
  • Writing Filenames into mp3 Tags with a Batch File
  • Rāma’s Story on the Prambanan Reliefs Published
  • eBooks on Ancient Buddhist Texts
  • Creating New Tags in Html5
  • Flipbook Showcase on Ancient Buddhist Texts
© 2026 Dharma Records | Powered by Minimalist Blog WordPress Theme