#16
|
|||
|
|||
You are missing my very first question. I do not want to just centre the page, but I'm trying zoom in to the level equivalent to "Fit Visible" (Ctrl+3) in adobe reader and then horizontally centre the page. It means the left and right margins of the page are not visible and you can see just the content of the page.
Your initial code is working perfectly, but just for small monitors. What I am trying to do now is to find the best zoom size according to the screen width, but I have no clue on how I can do it in vbscript. I reckon first step is to find the size of the screen. Any idea? |
#17
|
||||
|
||||
Word is not Acrobat and you did not ask how you could:
Quote:
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#18
|
|||
|
|||
Quote:
Please have a look at my first and second posts! I understand that there is no "Fit Visible" in word, but I want to have a macro to do kind of similar. The code you shared is doing this, but just for small monitors. How can one finds the size of the screen? |
#19
|
||||
|
||||
Your first and second posts were 5 months ago. To say:
Quote:
Quote:
Sure you mentioned '"Fit Visible" (Ctrl+3) in adobe reader' in your second post, but that contradicts your first post. Furthermore, yesterday, you asked: Quote:
Quote:
Do remember that this forum is run entirely by volunteers, none of whom can be expected to invest a huge amount of effort into writing a macro that emulates Acrobat's "Fit Visible" function on a wide range of hardware. For starters, that presupposes the person doing the coding knows the intricacies of how Acrobat treats different kinds of content. And, even if one did, the different algorithms used by Word and Adobe can even lead to the same zoom factors giving magnifications, depending on the hardware used (see, for example, https://www.msofficeforums.com/word/...ord-100-a.html).
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#20
|
|||||
|
|||||
Quote:
You were referring to your code (which was 3.5 months after my first post!!!), so it means that you reviewed the previous posts! I think you as an active member of this forum, whom I have seen and enjoyed answers' most of the time, should know that this is the way forums work. When a person leaves a question, he/she gets some feedback from other members. In response to those feedbacks, he/she does not repeat the whole question again and again and again! So, if another member wants to help, then he/she better quickly go through previous post and responds relatively, otherwise he/she is wasting the times of the other members. Anyway, I should say that your answer was the best I got for this question and I appreciate it. |
#21
|
|||
|
|||
Quote:
|
#22
|
||||
|
||||
Hi Gerry,
Yes, the screen size is irrelevant. And no, I don't believe you're missing anything. The OP's specifications have been quite inconsistent.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#23
|
|||
|
|||
Quote:
I think you are right! Thanks for this. So the question is that how one can find the display resolution in vbscript? Or maybe the way is to find the left and right margins of the current document, and then find the width of the content. Also if we can find the width of the word windows that can display document (minus navigation pane). then we can find the zoom ratio fro any resolution and any word windows size! Am I right? |
#24
|
||||
|
||||
The display resolution is equally irrelevant, but if you really want to find out:
Code:
Private Declare Function GetSystemMetrics32 Lib "User32" _ Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long Sub GetMonitorInfo() Dim h As Long, w As Long h = GetSystemMetrics32(1) ' height in pixels w = GetSystemMetrics32(0) ' width in pixels MsgBox Format(w, "#,##0") & " wide * " & Format(h, "#,##0") & " high" End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#25
|
|||
|
|||
Quote:
|
#26
|
||||
|
||||
Well, for starters, how about the Word window size, whether the vertical ruler is showing, and so on.
Given how close Word's 'FitText' setting is to Acrobat's Ctrl-3 setting and the fact that the built-in options in both programs take account of all the variables, I do have to wonder why you'd even bother trying to second-guess what Acrobat will do via a Word macro...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#27
|
|||
|
|||
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 Code:
.ActivePane.HorizontalPercentScrolled=50 Code:
.ActivePane.HorizontalPercentScrolled = 100 .ActivePane.HorizontalPercentScrolled = .ActivePane.HorizontalPercentScrolled / 2 |
#28
|
|||
|
|||
Quote:
I just sent the code that I edited a little bit, but it seams to be working. I defined a hotkey in word (F4) when I press it it shows the whole page, and when I press it again, it shows the bestfit. All I wanted is to bring it a bit closer and get rid of the margins. The code that I sent you does the job. But the thing is that I didn't realise wdPageFitTextFit option, maybe they just added in the latest version, am I right? (If not, I must missed this option which is doing the job) So all I did was that I used this option and managed to scroll the page to the centre. |
#29
|
||||
|
||||
Why don't you simply delete:
Code:
'Center the page .ActivePane.HorizontalPercentScrolled = 100 .ActivePane.HorizontalPercentScrolled = .ActivePane.HorizontalPercentScrolled / 2 Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#30
|
|||
|
|||
It does not scroll the page to the center just by itself. So I should scroll it to the center by those lines or any better way!
|
|
Similar Threads | ||||
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 |
Microsoft Word 2010 - Aligning table horizontally | 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 |