We've just upgraded our system to W2k3 terminal server with Word 2k3 SP1.
Macros which worked fine in Word97 are now a little flaky!
In a couple of places we have code as follows:
ChangeFileOpenDirectory UserDir
Dialogs(wdDialogFileOpen).Show
The Open dialog always appears but sometimes the "look in" folder is "My
Documents" not the directory set in UserDir. The directory in UserDir does
exist - we get an error if it doesn't.
There is no pattern to when the right directory appears, it can work
correctly fifteen times or more and then fail, alternatively it can fail
fifteen times and then work once.
Hi Richard
Try this instead
With Dialogs(wdDialogFileOpen)
.Name = UserDir
.Show
End With

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
> We've just upgraded our system to W2k3 terminal server with Word 2k3 SP1.
> Macros which worked fine in Word97 are now a little flaky!
[quoted text clipped - 10 lines]
> correctly fifteen times or more and then fail, alternatively it can fail
> fifteen times and then work once.
Richard Stone - 31 Jul 2005 11:08 GMT
Jonathan
Thanks for that, I've tried it but it does not give the desired results. :-(
Your code puts the folder name in the file name box and therefore does not
show the contents of the folder in the listbox that forms the main body of
the dialog. My original code lists the contents of the folder and leaves the
file name box empty.
Let me try to explain further...
We have a network drive that all users access, that has a folder
"precedents". The Precedents folder contains a load more sub-folders, one for
each department. These sub-folders hold a load of Word documents.
We've created a dialog box which contains a list box showing the sub-folders
of precedents, a user clicks on one of these, then clicks the Open button.
This should present the built in open dialog listing the word documents in
the subfolder.
Does this make sense? Any further ideas?
Thanks
Richard
> Hi Richard
>
[quoted text clipped - 19 lines]
> > correctly fifteen times or more and then fail, alternatively it can fail
> > fifteen times and then work once.
Jonathan West - 31 Jul 2005 12:30 GMT
> Jonathan
>
[quoted text clipped - 6 lines]
> the
> file name box empty.
Ah. You need to ensure that UserDir ends with a closing \ character. Then it
will behave right.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
Richard Stone - 01 Aug 2005 08:36 GMT
Jonathan
Many thanks, that's looking much better.
Richard
> > Jonathan
> >
[quoted text clipped - 9 lines]
> Ah. You need to ensure that UserDir ends with a closing \ character. Then it
> will behave right.