Changing default window properties

S

scott.siegler

Hello,

Is it possible to save the window properties of the office window on
startup. For example, I want to set the default size and position of
the window, so whenever I create a new blank document, the window opens
up with my default specs?

thanks,
Scott
 
B

Beth Rosengard

As far as I know, the answer is no. The size and location of the window is
determined by the size and location of the last window you opened in your
last session in Word. (Or is it the last window you closed? Either way, the
answer is still no.)

Sorry,

--
***Please always reply to the newsgroup!***

Beth Rosengard
MacOffice MVP

Mac Word FAQ: <http://word.mvps.org/Mac/WordMacHome.html>
My Site: <http://www.bethrosengard.com>
 
D

Daiya Mitchell

Oh! I think the answer is yes. If you open the Normal template, set the
size, space backspace to convince Word something needs to be saved, then
those settings should carry over to new documents (but not old documents,
and sometimes Word will lose track, so not 100% reliable). I'm not totally
sure about position.

But I got this off WinWord info, and am not sure I have tested it on
MacWord, though I think someone has, I vaguely remember a discussion of this
before.

Also, if you want to mess with macros, you can certainly automate a macro
that will set all windows to open at a certain size, and fixed position.
That's what I do (sorta), because changing the Normal template will not
affect documents that are created by other people and emailed to you.

Scott, post back if you are interested in a macro to do this.
 
J

Jacques

Daiya Mitchell said:
Also, if you want to mess with macros, you can certainly automate a macro
that will set all windows to open at a certain size, and fixed position.
That's what I do (sorta), because changing the Normal template will not
affect documents that are created by other people and emailed to you.

Scott, post back if you are interested in a macro to do this.

Daiya, I'd be interested to see this macro, please.
 
C

CyberTaz

Borrowed from the irrepressable Elliott Roper:
Sub ShiftWindow()
WordBasic.DocMove 3, 1
WordBasic.DocWindowHeight 975

End Sub


This one is creaky old from Word 6 and WordBasic, but works fine. Assign
to
a keystroke ---or a toolbar button. Adjust height (975) to suit.
 
S

scott.siegler

Hi Daiya,

I would be real interested in seeing this macro. Also, I am not too
experienced with using macros in Word, so can you also tell me what I
would need to do in order to have the macro run everytime a new window
or old file is open?

Thanks,
Scott
 
P

Phillip Jones

I see this reference from time to time of removing a space. For the
document to be identical except for desired changes Its actually type a
space, remove a space then save. if you just remove a space you end up
with a possible run on sentence or spacing in bullets or numbering being
incorrect. What you are after is some type of actual change in the
document in order to use "Save" to make the document spacing to be
correct it would be space > backspace. then save.

Daiya said:
Oh! I think the answer is yes. If you open the Normal template, set the
size, space backspace to convince Word something needs to be saved, then
those settings should carry over to new documents (but not old documents,
and sometimes Word will lose track, so not 100% reliable). I'm not totally
sure about position.

But I got this off WinWord info, and am not sure I have tested it on
MacWord, though I think someone has, I vaguely remember a discussion of this
before.

Also, if you want to mess with macros, you can certainly automate a macro
that will set all windows to open at a certain size, and fixed position.
That's what I do (sorta), because changing the Normal template will not
affect documents that are created by other people and emailed to you.

Scott, post back if you are interested in a macro to do this.

--
------------------------------------------------------------------------
Phillip M. Jones, CET |LIFE MEMBER: VPEA ETA-I, NESDA, ISCET, Sterling
616 Liberty Street |Who's Who. PHONE:276-632-5045, FAX:276-632-0868
Martinsville Va 24112 |[email protected], ICQ11269732, AIM pjonescet
------------------------------------------------------------------------

If it's "fixed", don't "break it"!

mailto:p[email protected]

<http://www.kimbanet.com/~pjones/default.htm>
<http://www.kimbanet.com/~pjones/90th_Birthday/index.htm>
<http://www.kimbanet.com/~pjones/Fulcher/default.html>
<http://www.kimbanet.com/~pjones/Harris/default.htm>
<http://www.kimbanet.com/~pjones/Jones/default.htm>

<http://www.vpea.org>
 
B

Beth Rosengard

Well, I was half wrong (or maybe a bit more than that because I forgot about
the macro option :).

Can you make a changed location stick, because I can't?! In the
experimenting I just did, I could change the size of Normal and that would
stick, but not the location/position.

Beth
 
D

Daiya Mitchell

I can't do it either. After posting I realized I was confused about what the
poster actually wanted, and that was why I had skipped answering the message
the first time around. :) It's sheer luck for me that the macro option
turns out to be true after all, though I have to think harder about it than
I thought. :)

Daiya
 
D

Daiya Mitchell

Sloppy writing on my part--I just write "space backspace" instead of
clarifying that I really mean "type a space, then backspace". :)
 
D

Daiya Mitchell

Okay, macros for default window properties:

To make a macro run automatically on every new doc, it must be named
AutoNew. To make a macro run automatically on every doc that is opened, it
must be named AutoOpen.

So, usually, your AutoNew and AutoOpen macros would be identical, to affect
every doc you ever see. Save them in Normal or some other global template,
no need to assign to a keyboard or toolbar.

One method in this case:

Since the position and size will be hard coded and adjusted to your monitor,
resolution size, zoom preference, dock position/size, etc, the easiest way
to get the numbers you require will be to record the macro. For instance,
here's a random assortment that I got, and what the macro might look like:

Sub AutoOpen
With ActiveWindow
.Left = 6
.Top = 2
.Width = 479
.Height = 797
End With
End Sub

When you record the macro, I'm not sure if you can name it AutoOpen. If you
can, you might just do that and then repeat the process for AutoNew. (I'm
not willing to mess up my AutoOpen/New macros by testing this. Also, if you
already have AutoOpen/New macros, that might overwrite them, you might check
first). I think you can only have one AutoOpen macro, but it can combine as
many settings as you want (see example below).

So, if you can't name it AutoOpen straight out, then just record it under
any name, e.g. testwindowsize. See Help topic: "Record a Macro" for help
with that. After recording the macro, use Tools | Macros... To see the list,
select your new macro, and click Edit. That will flip you into the Visual
Basic Editor and give you the macro text you need. Change the name of the
macro to Sub AutoNew, then copy the entire macro, paste it, and change the
name of the copy to Sub AutoOpen.

If these directions are confusing, post back with the glitches you ran
into--there are some general references on installing macros here:
http://word.mvps.org/Mac/InstallMacro.html
http://word.mvps.org/Mac/VisualBasicEditor.html
They don't cover this exact case, but could be used to clarify, probably,
rather than wait for an answer.

Daiya

PS. More about forcing window and other preferences below:

Related info‹
my usual AutoOpen and AutoNew macros set View and Zoom, not window position
or size, if anything wants something like this. These commands could be
combined with the sizing/position commands, as in the first example:

Sub AutoNew()
With ActiveWindow.View
.Type = wdNormalView
.Zoom.Percentage = 125
.TableGridlines = True
End With
With ActiveWindow
.Left = 6
.Top = 2
.Width = 479
.Height = 797
End With
End Sub

Sub AutoOpen()
With ActiveWindow.View
.Type = wdNormalView
.Zoom.Percentage = 125
.TableGridlines = True
End With
End Sub

Related Info--
Set the Arrange All menu command to tile windows vertically
http://www.mcgimpsey.com/macoffice/word/verticalwindows.html

Related Info‹
Global Templates
http://www.mcgimpsey.com/macoffice/word/globaltemplate.html

Related Info‹
an AutoExec macro will run every time you *launch* Word. This is good for
making sure application-level preferences always stay set to your liking.
 
J

John McGhie [MVP - Word and Word Macintosh]

Hi Daiya:

AutoOpens can contribute a little "entertainment value" in Word if there is
more than one document already open, due to the time taken to open the next
document.

I find that relying on "activedocument" in an AutoOpen is not always safe,
because the document does not become active until it has completed opening.

I usually get around it this way:

Sub AutoOpen()
Application.OnTime When:=Now + TimeValue("00:00:05"), _
Name:="SetWindowSize"

End sub


Sub SetWindowSize()

With ActiveWindow.View
.Type = wdNormalView
.Zoom.Percentage = 125
.TableGridlines = True
End With

With ActiveWindow
.Left = 6
.Top = 2
.Width = 479
.Height = 797
End With
End Sub

The first macro times out five seconds, then calls the second which actually
does the work. Five seconds may be too long on a fast system. But anything
shorter than 2 seconds is too short :)

Cheers


Okay, macros for default window properties:

To make a macro run automatically on every new doc, it must be named
AutoNew. To make a macro run automatically on every doc that is opened, it
must be named AutoOpen.

So, usually, your AutoNew and AutoOpen macros would be identical, to affect
every doc you ever see. Save them in Normal or some other global template,
no need to assign to a keyboard or toolbar.

One method in this case:

Since the position and size will be hard coded and adjusted to your monitor,
resolution size, zoom preference, dock position/size, etc, the easiest way
to get the numbers you require will be to record the macro. For instance,
here's a random assortment that I got, and what the macro might look like:

Sub AutoOpen
With ActiveWindow
.Left = 6
.Top = 2
.Width = 479
.Height = 797
End With
End Sub

When you record the macro, I'm not sure if you can name it AutoOpen. If you
can, you might just do that and then repeat the process for AutoNew. (I'm
not willing to mess up my AutoOpen/New macros by testing this. Also, if you
already have AutoOpen/New macros, that might overwrite them, you might check
first). I think you can only have one AutoOpen macro, but it can combine as
many settings as you want (see example below).

So, if you can't name it AutoOpen straight out, then just record it under
any name, e.g. testwindowsize. See Help topic: "Record a Macro" for help
with that. After recording the macro, use Tools | Macros... To see the list,
select your new macro, and click Edit. That will flip you into the Visual
Basic Editor and give you the macro text you need. Change the name of the
macro to Sub AutoNew, then copy the entire macro, paste it, and change the
name of the copy to Sub AutoOpen.

If these directions are confusing, post back with the glitches you ran
into--there are some general references on installing macros here:
http://word.mvps.org/Mac/InstallMacro.html
http://word.mvps.org/Mac/VisualBasicEditor.html
They don't cover this exact case, but could be used to clarify, probably,
rather than wait for an answer.

Daiya

PS. More about forcing window and other preferences below:

Related info‹
my usual AutoOpen and AutoNew macros set View and Zoom, not window position
or size, if anything wants something like this. These commands could be
combined with the sizing/position commands, as in the first example:

Sub AutoNew()
With ActiveWindow.View
.Type = wdNormalView
.Zoom.Percentage = 125
.TableGridlines = True
End With
With ActiveWindow
.Left = 6
.Top = 2
.Width = 479
.Height = 797
End With
End Sub

Sub AutoOpen()
With ActiveWindow.View
.Type = wdNormalView
.Zoom.Percentage = 125
.TableGridlines = True
End With
End Sub

Related Info--
Set the Arrange All menu command to tile windows vertically
http://www.mcgimpsey.com/macoffice/word/verticalwindows.html

Related Info‹
Global Templates
http://www.mcgimpsey.com/macoffice/word/globaltemplate.html

Related Info‹
an AutoExec macro will run every time you *launch* Word. This is good for
making sure application-level preferences always stay set to your liking.

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 (0) 4 1209 1410
 
J

Jacques

Daiya, thank you: this works fine if you put the macro in the Normal
template. (It's like magic!) But when I put it in a global template of
my own, I get a "compile error" saying that the name AutoOpen is
"ambiguous".

This seemed to me to imply that Word didn't like the name AutoOpen
because I had already put an (identical) AutoOpen macro in the Normal
template. But that can't be it, because I tried renaming Normal and
restarting Word (so as to restore the original version of Normal without
the AutoOpen macro) and I still get a compile error from the AutoOpen
macro in my own global template -- except that it now says "Compile
error in hidden module: NewMacros".

So is it simply that you can't have a macro called AutoOpen (or
Auto****) in a global template other than Normal? If so, it's no big
deal: I'm just trying to get my head around this stuff.

Jacques
(using Word 2004)
 
S

scott.siegler

Hi Daiya,

This is great. It works perfect.

I have 2 questions. The reason I originally asked this question to
begin with is because when I open a Word document, for some reason the
window opens with the top flush with the top of the screen, not the top
of the bottom toolbar. Therefore, the top of my window has always been
hidden under the two toolbars I have. Im not sure why it does this and
I was looking for some type of preference to change this.

So, question 1 - do you have any idea why it would do this, or are the
macros you provided the only way for me to move the window?

Question 2 is I created AutoNew and AutoOpen like you described. Both
work except for the original window that opens upon starting Word.
Once Word is open, creating a new window or openining an old file - i
get the position I want. Is there a third macro I would need to get
the original window Word opens to get the same position behavior?

Thanks again for all your help

Scott
 
D

Daiya Mitchell

Thanks, John, very snazzy. Saved in "Useful Macros".

I don't recall ever seeing this timing problem, although it may explain some
oddities previously when I was using Notebook Layout view.

Daiya
 
D

Daiya Mitchell

Hi Jacques,

I have no idea (and I'm very novice at macros, so with luck someone else
will chime in on this).

My AutoNew and AutoOpen macros are in Normal, so I haven't tested this. My
AutoExec (which sets some prefs on every launch) is in my Global Macros
template, though, so at least *some* auto macros can be global templates.

If you go into the Visual Basic Editor and select Help, there is a topic
"Auto Macros" that might offer some enlightenment (didn't for me, though).
John McGhie or some other macro expert hopefully will come along and explain
it.

Question--are you seeing the problem with the original new document that
Scott is seeing (where it doesn't run on the first one)? What does your
macro do? (or what is the code?)

Daiya
 
D

Daiya Mitchell

Hi Scott,

I have 2 questions. The reason I originally asked this question to
begin with is because when I open a Word document, for some reason the
window opens with the top flush with the top of the screen, not the top
of the bottom toolbar. Therefore, the top of my window has always been
hidden under the two toolbars I have. Im not sure why it does this and
I was looking for some type of preference to change this.

So, question 1 - do you have any idea why it would do this, or are the
macros you provided the only way for me to move the window?

Oh, that's a totally different issue. Your toolbars became undocked. If you
float them around and let them drop into the sweet spot, then drop the
document into the sweet spot below them (with a little bitty gap), then Word
would remember the right placement and sort it all out for you henceforth
for the next umpteen launches (until something undocked them again).

No need for macros, really, just to solve that.
Question 2 is I created AutoNew and AutoOpen like you described. Both
work except for the original window that opens upon starting Word.
Once Word is open, creating a new window or openining an old file - i
get the position I want. Is there a third macro I would need to get
the original window Word opens to get the same position behavior?

No idea at all, I don't see that here, and AutoNew seems to run on my
original new doc, and the VB Help topics on Auto Macros offers no other
candidate to run on a special doc like that.

Jacques, do you see that? Scott, what exact version of Word and OS (intel
or PPC) are you seeing this in?

Some macro expert (because I'm very novice) may chime in, with luck.
Thanks again for all your help

You're welcome.

Daiya
 
B

Beth Rosengard

Hi Scott,

You didn't need the macro to fix that! The problem is that your toolbars
are "undocked". All you need to do is drag them down a little and then
slowly back up until they click into position. Once that happens, the
document window will jump to its proper place below the toolbars.

Not being a macro person myself, you'll have to wait for Daiya on question
2.

--
***Please always reply to the newsgroup!***

Beth Rosengard
MacOffice MVP

Mac Word FAQ: <http://word.mvps.org/Mac/WordMacHome.html>
My Site: <http://www.bethrosengard.com>
 
J

Jacques

Daiya, thanks for pointing me to the VBE help - I hadn't realised that
this was separate from the ordinary Word help. The page on Auto Macros
is indeed helpful. The thing about an AutoOpen (or AutoClose) macro,
apparently, is that it only runs when you open (or close) --
(a) a document or template that contains the macro, or
(b) a document based on a template that contains the macro.
If neither of these is the case, it seems that the macro does not run --
even if it is in the Normal template, or another global template which
is currently loaded. Similarly, an AutoNew macro runs only when you
create a document *based on* a template which contains it -- not merely
because a global template containing it is currently loaded.

Anyway I decided that I was just confusing myself by using another
global template as well as Normal, so in the interests of KISS I have
reverted to using Normal as my only global template for the moment. (I
will try and remember to keep backing it up.)

I have copied the AutoOpen macro to the document template to which most
of my documents are attached, and it seems to work fine if I open one of
these documents.

I have copied the same macro to the Normal template as AutoNew, and it
works fine if I create a new document with Command-N. But yes, I find
the same thing as Scott: AutoNew does *not* run when I start Word up and
it automatically creates a new blank document. (Incidentally I wish it
wouldn't create the new document at all, but I suppose one could create
a macro to close the document immediately, or to stop Word creating it
in the first place.) So maybe a macro relating to the
automatically-created document has to go in AutoExec rather than
AutoNew?

Both my AutoOpen and my AutoNew are essentially the same as the one you
gave in your previous post (but with different numbers).

Thanks very much for your help with this. It's a steep learning curve at
the moment, but I'm determined to show Word who's boss.

Jacques
 
D

Daiya Mitchell

Hi Jacques,

Thanks much, your investigation is extremely helpful--

Daiya, thanks for pointing me to the VBE help - I hadn't realised that
this was separate from the ordinary Word help. The page on Auto Macros
is indeed helpful. The thing about an AutoOpen (or AutoClose) macro,
apparently, is that it only runs when you open (or close) --
(a) a document or template that contains the macro, or
(b) a document based on a template that contains the macro.

Ah ha! Thanks for the restatement, I read that topic, but didn't get it.
So yes, that would mean they need to be in the Normal template, not a global
template.
If neither of these is the case, it seems that the macro does not run --
even if it is in the Normal template, or another global template which
is currently loaded. Similarly, an AutoNew macro runs only when you
create a document *based on* a template which contains it -- not merely
because a global template containing it is currently loaded.

"Based on", by the way, is a little loose--my AutoOpen macro runs on all the
documents I open from my students that are based on *their* Normal template.
Anyway I decided that I was just confusing myself by using another
global template as well as Normal, so in the interests of KISS I have
reverted to using Normal as my only global template for the moment. (I
will try and remember to keep backing it up.)

I've got an Applescript that copies certain files like that to a Backup
location, which I try to remember to run from the OS menu every day. Quick
and dirty, but easy enough it gets done.
I have copied the AutoOpen macro to the document template to which most
of my documents are attached, and it seems to work fine if I open one of
these documents.

It might also be worth creating the macro as ResizeWindow for manual
triggering when necessary.
I have copied the same macro to the Normal template as AutoNew, and it
works fine if I create a new document with Command-N. But yes, I find
the same thing as Scott: AutoNew does *not* run when I start Word up and
it automatically creates a new blank document. (Incidentally I wish it
wouldn't create the new document at all, but I suppose one could create
a macro to close the document immediately, or to stop Word creating it
in the first place.)

Nothing you can do about that first new document, sorry. I wouldn't try to
stop Word creating it, but the macro to close it could work. You could try
to develop the habit of launching Word by double-clicking an existing doc
(then that blank doc doesn't come up).
So maybe a macro relating to the
automatically-created document has to go in AutoExec rather than
AutoNew?

Let us know what happens when you try it. :) The thing is, different
properties behave differently--for instance, I always get the right Zoom and
View on launch, but technically, I shouldn't need a macro to get those
anyhow, so I don't know if it's really the macro kicking in. But I think
you are only seeing this because you want position and size, which seem to
operate differently. In fact, based on that logic, the sizing ought to come
out right, but not the position?

Also, you might review the timing trick that John McGhie posted on this
thread, to give a delay before the macro runs.
Both my AutoOpen and my AutoNew are essentially the same as the one you
gave in your previous post (but with different numbers).

Thanks very much for your help with this. It's a steep learning curve at
the moment, but I'm determined to show Word who's boss.

That's the right attitude! the only path toward peace with Word, really. :)

Daiya
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top