Hi Kevs:
Well... The macro should not be in the "Document". It should be in the
Normal template. It won't work properly if it is not.
And the macro will be quite stable: it will always give you 125%.
You can also make it move the window if you like... Here you go:
Sub SetWindowSize()
'
' SetWindowSize Macro
'
'
Dim aDoc As Document
Dim aWindow As Window
Set aDoc = ActiveDocument
Set aWindow = aDoc.ActiveWindow
With aWindow
.WindowState = wdWindowStateNormal
.Height = (Application.UsableHeight * 1)
.Width = (Application.UsableWidth * 0.5)
.Left = ((Application.UsableWidth - .Width) / 2)
.View.Zoom.Percentage = 125
End With
End Sub
Compare carefully: You will see two changes.
First, I removed the ".Top" line: there is no point in specifying it, since
we are specifying a height of 100%, so it can only be "0".
Next, I changed the .Left line to put the Word window in the middle of the
screen for you. What it does is retrieve the "UseableWidth" from Mac OS X
and subtract the width you set for your Word window to work out how much
room is left, then divide that in half.
The "Left" parameter sets the position of the left edge of the Word window,
so this calculation sets every Word document to be half the available width
of the screen and right in the middle.
Just paste into TextEdit, "Make plain text" then paste into the VBA Editor
over the top of the code you have now.
Check carefully that you have pasted accurately, and it will work (I know, I
tested it in Word 2004 for you).
Cheers
Thanks John,
For Word, I got the Normal to set at 125%.
So all new docs are at that which is nice.
Only thing cant achieve in Word for the new Docs is this:
they shoot to the left side of the monitor.
With old docs, i position them where I want and it stick, but for new docs it
wont stick, always shoots to the left. Anything I can do? I hate dragging it
everytime to the center of the monitor.
I'm thinking it's no big deal to set to 125% for all the old docs, better than
having a unstable macro in all future docs - do you agree?
--
The email below is my business email -- Please do not email me about forum
matters unless I ask you to; or unless you intend to pay!
John McGhie, Microsoft MVP (Word, Mac Word), Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. | Ph: +61 (0)4 1209 1410
+61 4 1209 1410, mailto:
[email protected]