Thanks for the help. With this I found some examples that allowed me to do
what I needed. The code follows:
ChangeFileOpenDirectory "C:\Documents and Settings\Mark\My Documents\Cars"
SendKeys "%l{Left}d%t{Home}{Tab}"
Dialogs(wdDialogFileOpen).Show
The SendKeys first sets the view to detail and then sets the Files of type
to All Files.
Mark
> Have a look at the Help topic 'Built-in Dialog Box Argument Lists'. The
> general method is --
[quoted text clipped - 20 lines]
> > Thanks
> > Mark
Sendkeys is the worst possible way to do it. That command is absolutely the
last resort for interacting with apps that provide no direct communication
method. The problems with using SendKeys are a) you are at the mercy of
whatever ends up in the computer's message queue, and b) you've got no way
to deal with unexpected conditions -- in this case, the user clicking
Cancel, for example, or triggering an error by changing folder to something
invalid, or selecting a locked file, etc etc.
And given that the Dialogs() object provides a whole set of methods and
exposes all the properties of the dialog (so that you *can* deal with all
those conditions), it's inefficient and just plain absurd.
On top of which, if you're just trying to get a filename, you don't want to
*Show* the dialog; you want to Display it. Otherwise Word itself will
actually open the file.
> Thanks for the help. With this I found some examples that allowed me to
> do
[quoted text clipped - 37 lines]
>> > Thanks
>> > Mark
mrojava - 21 Nov 2006 13:22 GMT
OK, so far I've changed it to
ChangeFileOpenDirectory "C:\Documents and Settings\Mark\My Documents\Cars"
SendKeys "%l{Left}d"
With Dialogs(wdDialogFileOpen)
.Name = "*.*"
.Show
End With
But I've been unable to find an example of how to force the view to detail
other than SendKeys. Perhaps you can tell me.
Mark
> Sendkeys is the worst possible way to do it. That command is absolutely the
> last resort for interacting with apps that provide no direct communication
[quoted text clipped - 53 lines]
> >> > Thanks
> >> > Mark
Steve Yandl - 21 Nov 2006 15:00 GMT
Mark,
Try this.
Sub MyFileOpen()
With Dialogs(wdDialogFileOpen)
.Name = "C:\Documents and Settings\Mark\My Documents\Cars"
.Show
End With
End Sub
Steve
> OK, so far I've changed it to
>
[quoted text clipped - 79 lines]
>> >> > Thanks
>> >> > Mark
mrojava - 21 Nov 2006 18:58 GMT
Steve, Thanks for your post. However, I am looking for a way to force the
view of the File/Open screen to be detail. The only successful way that I
have found is via the SendKeys statement.
Mark
> Mark,
>
[quoted text clipped - 92 lines]
> >> >> > Thanks
> >> >> > Mark