![]() |
#1
|
|||
|
|||
![]()
I am trying to zoom in and then center the page by the following code but it doesn't work:
ActiveDocument.ActiveWindow.View.Zoom.Percentage = 250 ActiveWindow.ActivePane.HorizontalPercentScrolled = 50 Any idea? |
#2
|
|||
|
|||
![]()
Are you trying to change the view or are you trying to make the text vertically centered on the page?
Or, are you trying to get the insertion point to a particular spot in the document? |
#3
|
|||
|
|||
![]()
I'm just trying to change the view!
Actually what I'm trying to achive is exactly equivalent to "Fit Visible" (Ctrl+3) in adobe reader. Thanks in advance! |
#4
|
|||
|
|||
![]()
any solution?
|
#5
|
||||
|
||||
![]()
Possibly something like:
Code:
Sub Test() Dim lZoom As Long 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 fit .PageFit = wdPageFitBestFit 'Get the full-screen zoom lZoom = .Percentage 'Set zoom % to 250% min If .Percentage < 250 Then .Percentage = 250 End With 'Center the page .ActivePane.HorizontalPercentScrolled = (250 - lZoom) / 5 'Restore the window now that we're finished .Visible = True End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
![]()
Thanks for your reply, but it does not work!
|
#7
|
||||
|
||||
![]()
Works for me ...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
![]()
Could you explain the code a little bit? Especially .Percentage and lZoom and what they are defined for?
|
#9
|
||||
|
||||
![]()
Did you read the comments in the code? I'd have thought they made it apparent what was going on.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
![]()
On my laptop in Word 2010 it produces an overzoom to 250% when the correct zoom would be 150%.
When I substitute 150 for 250 throughout the procedure, it works on my machine. |
#11
|
||||
|
||||
![]()
I used 250% only because that's what b0x4it seems to require (see the first post in this thread).
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
|||
|
|||
![]() Quote:
This also works for me but just on my laptop with 15.1" monitor. It does nothing on my 27" monitor. How can I relate this code to the size of the screen instead of a fix number (250% in this code)? |
#13
|
||||
|
||||
![]() Quote:
Code:
Dim lZoom As Long Code:
'Get the full-screen zoom lZoom = .Percentage 'Set zoom % to 250% min If .Percentage < 250 Then .Percentage = 250 Code:
'Center the page .ActivePane.HorizontalPercentScrolled = (250 - lZoom) / 5
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#14
|
|||
|
|||
![]()
If you delete these codes, then how it scrolls horizontally to the centre?
|
#15
|
||||
|
||||
![]()
Have you tried it?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Centering text horizontally in powerpoint | Microsoftenquirer1000 | PowerPoint | 0 | 10-28-2012 03:38 PM |
How to Center One Line Vertically on Blank Page | SQLUSA | Word | 1 | 08-29-2012 08:14 PM |
Word doc that scroll horizontally | Golfer4588 | Word | 1 | 03-22-2012 03:55 PM |
![]() |
SWEngineer | Word Tables | 4 | 07-20-2011 01:32 AM |
Labels will only print in center of page | jferr | Word | 0 | 04-02-2010 09:52 AM |