View Single Post
 
Old 11-12-2013, 09:33 PM
b0x4it b0x4it is offline Windows 7 32bit Office 2010 32bit
Advanced Beginner
 
Join Date: May 2011
Posts: 95
b0x4it is on a distinguished road
Default

This is working! This as far as I tried, zoom in on the text and hide the margins, and also horizontally scroll to the middle, no matter to the size of the monitor, screen resolution and size of the word window whether it is full screen or not:

Code:
Sub test()
With ActiveWindow
  'Ignore any errors
  On Error Resume Next
  'Reduce flickering while changing settings
  .Visible = False
  'Switch to a single view pane
  .View.SplitSpecial = wdPaneNone
  'Switch to Print Preview mode
  .View.Type = wdPrintView
  With .ActivePane.View.Zoom
    'Set for a 1-page view
    .PageColumns = 1
    'Initialize for best text fit
    .PageFit = wdPageFitTextFit
    'Get the full-screen zoom
  End With
  'Center the page
  .ActivePane.HorizontalPercentScrolled = 100
  .ActivePane.HorizontalPercentScrolled = .ActivePane.HorizontalPercentScrolled / 2
  'Restore the window now that we're finished
  .Visible = True
End With
End Sub
I couldn't find any way to scroll the page horizontally to the middle using just one line like this:
Code:
.ActivePane.HorizontalPercentScrolled=50
as 50% does not scroll it to the middle. To find out where is the middle, I first move it to the right, read the scroll percentage, and then scroll the page it to the half of what it was at the most right. Do you know a better way to do what these are doing:

Code:
  .ActivePane.HorizontalPercentScrolled = 100
  .ActivePane.HorizontalPercentScrolled = .ActivePane.HorizontalPercentScrolled / 2
Reply With Quote