Newbie Word question

  • Thread starter James L Szatkowski, PE
  • Start date
J

James L Szatkowski, PE

I've got a WinXPro (SP2 and all patches since) machine I just put together
on a new laptop (Micron Transport 2400 from previous model). When it boots,
the new machines' wireless connection takes a while (a couple of minutes) to
find the network, find the DHCP and get IP address, and show it's connected.
During this time the Office applications that have had their default file
locations changed to networked drive file locations - all reset to C:\...\My
Documents. I've tried writing batch to re-insert the REG key with the
remote location -that,for some reason won't work either.

What I'd like to do is find a VBA script that will execute on application
open, check the default file location - if it's not what it's supposed to
be, then change to the correct one. Word won't be opened until the network
connection is made - or even the VBA script could check for that network
drive and if it's there, change to it?

I assume this has been done before, but I've not found by Google'ing it - I
suppose I'm searching on the wrong words....

Thanks for the advice and help in advance !

Jim
 
G

GeoffG

Word won't be opened until the network
connection is made

If Word is started *after* the network connection is good, Word should use
the default network folder (as shown in the Tools > Options > File
Locations).

If Word is started *before* the network connection is good, Word will change
its current folder to "C:\...\My Documents". Word changes its current
folder if the default folder does not exist or is unavailable.

It would seem the simple solution to your problem is to wait until the
network connection is made before starting any Office application.

It seems you believe Office applications change their default folders while
the network is being established and, as a consequence, you need some code
to reset them back to what they should be. In fact, Office applications
shouldn't change their default folders so long as you don't start them
before the network is up and running.

Incidentally, I did write some code to make Word quit if the default folder
for documents were unavailable. It gets really messy for several reasons.

First, the code needs to run in the Normal template as a macro named
"AutoOpen" before the network is up. Therefore, the normal template (or at
least a local copy of it) has to be on the laptop. If your default folder
for templates is on the network, you've got a maintenance headache. (There
are commandline switches that will start Word using a different template or
startup macro, but they also need maintenance.)

Secondly, there was a problem with Word 2000 and Word 2002 and I don't know
whether the problem persisted in later versions. If the default folder for
documents is unavailable, the code that should return the default folder for
documents, in fact returns the current folder (i.e. the folder Word has
changed to). So the following code doesn't do what you expect (it returns
the current folder, not the default folder):

Dim strDefaultFolder As String
strDefaultFolder = Word.Application.Options.DefaultFilePath( _
wdDocumentsPath)

You have to replace the above code with a workaround like this (see
Microsoft article 220193):

Dim objDLG As Word.Dialog
Dim strDefaultFolder As String

' Point to Word's Options dialog (File Locations tab):
Set objDLG = Word.Application.Dialogs( _
wdDialogToolsOptionsFileLocations)

' The "Setting" property of the dialog returns Word's
' default folder for documents:
strDefaultFolder = objDLG.setting

' Clean up:
Set objDLG = Nothing

And all this just for Word...

They say patience is a virtue... I think it's best to wait until your
network is connected.

Regards
Geoff
 

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