Load order of templates

M

mansky99

Hi,
I understand that if I have more than one template in the Word Startup
folder, that they are loaded in reverse alphabetical order (Z --> A). Is the
Normal template always loaded first by Word, before any global templates in
the Startup folder are loaded?

I'd like Normal to be loaded after the templates in the Startup folder are
loaded. How does one do that? More generally, can one specify to Word to load
a set of templates in Startup and My Templates, together w/Normal, to be
loaded in a specific order ? ie. can one override the default reverse
alphabetic load sequence?


Thanks!

Ed
 
J

John McGhie [MVP - Word and Word Macintosh]

Hi Ed:

I assume you have been reading the article by Karen Walker, Senior Developer
with Payne Consulting Group, Inc. at
http://www.payneconsulting.com/pub_books/articles/pdf/HowWordLooksforandLoad
sTemplates.pdf

Karen appears to be writing about Word 2003. She determined her results by
experimentation. I am afraid that you need to do the same. There is no
guarantee that Mac Word does the same thing :)

I don't think Karen mentioned it, but Normal is always loaded "First",
although it is the "last" place Word will look for macros.

Our sad experience is that it is simply not safe to "assume" that Word will
load add-ins in any given order. You "may" be able to get the order stable
for a single machine in an unchanging environment. But I would recommend
that you do not rely on it. In a multi-user networked environment, forget
it: you have a better chance in the lottery :)

If you tell us what you are trying to do, we can be a lot more help.
Personally, I use Application.Run or Call or enumerate the add-ins to ensure
that it does not "matter" in which order Word loads things.

You can make things more stable by carefully controlling your Customisation
Context, but again, I do not bother.

Decide what you need and call it explicitly when you need it: it's the only
safe way.

Hope this helps

Hi,
I understand that if I have more than one template in the Word Startup
folder, that they are loaded in reverse alphabetical order (Z --> A). Is the
Normal template always loaded first by Word, before any global templates in
the Startup folder are loaded?

I'd like Normal to be loaded after the templates in the Startup folder are
loaded. How does one do that? More generally, can one specify to Word to load
a set of templates in Startup and My Templates, together w/Normal, to be
loaded in a specific order ? ie. can one override the default reverse
alphabetic load sequence?


Thanks!

Ed

--

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

JE McGimpsey

Our sad experience is that it is simply not safe to "assume" that Word will
load add-ins in any given order. You "may" be able to get the order stable
for a single machine in an unchanging environment. But I would recommend
that you do not rely on it. In a multi-user networked environment, forget
it: you have a better chance in the lottery :)

I usually have between 5 and 10 add-ins that load at startup. I
explicitly load several of these add-ins in my desired order. I put all
my add-ins in a folder outside the Startup folder, put an alias to my
startup add-in in the Startup folder, then the startup add-in's
Auto_Exec macro calls a macro that loads the remaining add-ins into the
Addins collection and install them. For example:

Public Sub LoadAddIns()
Dim vAddInList As Variant
Dim i As Long
Dim sAddInPath As String
Dim sFileName As String
With ThisDocument 'All add-ins in the same folder.
sAddInPath = Left(.FullName, Len(.FullName) - Len(.Name))
End With
vAddInList = Array("jemWordWorkMenu.dot", _
"VBA6_functions.dot", _
"my_workbar.dot", _
"my_replacement_commands.dot", _
"OpenAttachedTemplate.dot", _
"my_styles.dot", _
"ResizeComments.dot", _
"my_macros.dot")
For i = LBound(vAddInList) To UBound(vAddInList)
sFileName = sAddInPath & vAddInList(i)
If Len(Dir(sFileName)) > 0 Then
AddIns.Add FileName:=sFileName, Install:=True
Else
Debug.Print "Can't Find Add-in: " & sFileName
End If
Next i
End Sub

Then in my startup add-in's AutoExit macro, I call a macro to uninstall
and remove the addins:

Public Sub UnloadAddIns()
On Error Resume Next
AddIns.Unload RemoveFromList:=True
End Sub
 
M

mansky99

Hi John,
No, I didn't know of Karen Walker's article of Word Templates. I was
searching the MS Communities for messages relating to template load order
when I ran across one post that mentioned reverse alphabetic. Thanks for the
link, it helps a lot to read others results.

I have done my own testing on Mac Word 10.1.6 on OSX 10.2.8 and indeed see
the reverse alphabetic load order --and-- the fact that Normal is always
loaded first. I also found, that if Normal has a reference to a global
template in it (here I mean a template file in the Startup folder), it will
automatically try to load that template as well.

I my particular case I needed my global templates to load in a specific
order because of the tasks each does. I had to name them, keeping in mind the
reverse alphabetic order, such that my global templates were loaded in the
order I needed them.

Is it true then that you can't delay the loading of Normal until after all
global templates have been loaded in Word?



Ed

John McGhie [MVP - Word and Word Macinto said:
Hi Ed:

I assume you have been reading the article by Karen Walker, Senior Developer
with Payne Consulting Group, Inc. at
http://www.payneconsulting.com/pub_books/articles/pdf/HowWordLooksforandLoad
sTemplates.pdf

Karen appears to be writing about Word 2003. She determined her results by
experimentation. I am afraid that you need to do the same. There is no
guarantee that Mac Word does the same thing :)

I don't think Karen mentioned it, but Normal is always loaded "First",
although it is the "last" place Word will look for macros.

Our sad experience is that it is simply not safe to "assume" that Word will
load add-ins in any given order. You "may" be able to get the order stable
for a single machine in an unchanging environment. But I would recommend
that you do not rely on it. In a multi-user networked environment, forget
it: you have a better chance in the lottery :)

If you tell us what you are trying to do, we can be a lot more help.
Personally, I use Application.Run or Call or enumerate the add-ins to ensure
that it does not "matter" in which order Word loads things.

You can make things more stable by carefully controlling your Customisation
Context, but again, I do not bother.

Decide what you need and call it explicitly when you need it: it's the only
safe way.

Hope this helps

Hi,
I understand that if I have more than one template in the Word Startup
folder, that they are loaded in reverse alphabetical order (Z --> A). Is the
Normal template always loaded first by Word, before any global templates in
the Startup folder are loaded?

I'd like Normal to be loaded after the templates in the Startup folder are
loaded. How does one do that? More generally, can one specify to Word to load
a set of templates in Startup and My Templates, together w/Normal, to be
loaded in a specific order ? ie. can one override the default reverse
alphabetic load sequence?


Thanks!

Ed

--

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

JE McGimpsey

mansky99 said:
I my particular case I needed my global templates to load in a specific
order because of the tasks each does. I had to name them, keeping in mind the
reverse alphabetic order, such that my global templates were loaded in the
order I needed them.

See the post I made in another subthread. It's easy to load in specific
order, without regard to file name, using VBA to load them...
Is it true then that you can't delay the loading of Normal until after all
global templates have been loaded in Word?

I believe that's true.
 
M

mansky99

Excellent script, thanks for posting it. I hadn't thought of using the Add
method of the AddIns collection class to specify a load order. Is using
AddIns.Add the same as placing template files in the Startup folder and
letting Word load them automatically via the reverse alphabetic order?


Ed
 
J

JE McGimpsey

mansky99 said:
Is using AddIns.Add the same as placing template files in the Startup
folder and letting Word load them automatically via the reverse
alphabetic order?

No, it simply adds the files to the Addins collection. In order to
actually load the add-in, you need to set the Installed property to
True, either in the Addins.Add command's Installed argument, or via

Addins(x).Installed = True
 
J

John McGhie [MVP - Word and Word Macintosh]

Hi Ed:

No, you can't delay the loading of Normal: it's part of the application :)

You are going to a bad place trying to rely on this reverse alphabetic load
order: it's just not stable, it WILL end in tears :)

Use J.E.'s macro to load the templates in the order that you need them :)

May I ask, for your personal machine, why you would NEED more than one? And
why would it not be Normal template?

That's the purpose of Normal template -- to get code loaded for your
particular and specific use. Since each template/add-in you load has an
overhead (maybe a hundred k, depending what's in it) you would normally
reduce the number you load to the minimum.

So the only reason you would have multiple add-ins is because you intend to
load and unload them as you need them. If you're intending to load them and
leave them, you would normally choose to have only one. Then you don't have
to consider this problem at all.

In the meantime, I would strongly suggest that you consider migrating your
function to AppleScript. AppleScript is the way forward in Word on the Mac.

VBA currently does not access the full functionality of Mac Word, and that
is going to get progressively worse with each new release until eventually,
VBA will not be a realistic solution on the Mac.

In the next version of Mac Word, I suspect that we will find that "a lot" of
the every-day functionality will be inaccessible to VBA. Word is going to
get major changes: VBA is a dead technology that is not going to get
updated, because it can't be secured sufficiently. On the PC, the new
functionality is all moving to VB.NET, which can be locked down.

The only thing VB.NET has in common with VBA is the name: it's a completely
different platform, and there's little likelihood that it will come to the
Mac platform: we don't need it, we have AppleScript.

Hope this helps

Cheers

Hi John,
No, I didn't know of Karen Walker's article of Word Templates. I was
searching the MS Communities for messages relating to template load order
when I ran across one post that mentioned reverse alphabetic. Thanks for the
link, it helps a lot to read others results.

I have done my own testing on Mac Word 10.1.6 on OSX 10.2.8 and indeed see
the reverse alphabetic load order --and-- the fact that Normal is always
loaded first. I also found, that if Normal has a reference to a global
template in it (here I mean a template file in the Startup folder), it will
automatically try to load that template as well.

I my particular case I needed my global templates to load in a specific
order because of the tasks each does. I had to name them, keeping in mind the
reverse alphabetic order, such that my global templates were loaded in the
order I needed them.

Is it true then that you can't delay the loading of Normal until after all
global templates have been loaded in Word?



Ed

John McGhie [MVP - Word and Word Macinto said:
Hi Ed:

I assume you have been reading the article by Karen Walker, Senior Developer
with Payne Consulting Group, Inc. at
http://www.payneconsulting.com/pub_books/articles/pdf/HowWordLooksforandLoad
sTemplates.pdf

Karen appears to be writing about Word 2003. She determined her results by
experimentation. I am afraid that you need to do the same. There is no
guarantee that Mac Word does the same thing :)

I don't think Karen mentioned it, but Normal is always loaded "First",
although it is the "last" place Word will look for macros.

Our sad experience is that it is simply not safe to "assume" that Word will
load add-ins in any given order. You "may" be able to get the order stable
for a single machine in an unchanging environment. But I would recommend
that you do not rely on it. In a multi-user networked environment, forget
it: you have a better chance in the lottery :)

If you tell us what you are trying to do, we can be a lot more help.
Personally, I use Application.Run or Call or enumerate the add-ins to ensure
that it does not "matter" in which order Word loads things.

You can make things more stable by carefully controlling your Customisation
Context, but again, I do not bother.

Decide what you need and call it explicitly when you need it: it's the only
safe way.

Hope this helps

Hi,
I understand that if I have more than one template in the Word Startup
folder, that they are loaded in reverse alphabetical order (Z --> A). Is the
Normal template always loaded first by Word, before any global templates in
the Startup folder are loaded?

I'd like Normal to be loaded after the templates in the Startup folder are
loaded. How does one do that? More generally, can one specify to Word to
load
a set of templates in Startup and My Templates, together w/Normal, to be
loaded in a specific order ? ie. can one override the default reverse
alphabetic load sequence?


Thanks!

Ed

--

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

--

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
 

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