File/Open/Files of Type

M

mrojava

I am trying to create a desktop shortcut that will open word and invoke a
macro that does a file/open to a particular folder with a "Files of type"
being All files (*.*). Can someone send me a code fragment for setting
"Files of type". Here is what I've found by example so far. I am not a
programmer.

ChangeFileOpenDirectory "C:\Documents and Settings\Mark\My Documents\Cars"
'Documents.Open FileName:="*.*"
Dialogs(wdDialogFileOpen).Show
' CommandBars.FindControl(ID:=23, Visible:=False).Execute

Uncommenting the Documents.Open Filename generates an error.

Thanks
Mark
 
J

Jezebel

Have a look at the Help topic 'Built-in Dialog Box Argument Lists'. The
general method is --

With Dialogs(wdDialogFileOpen)
.[Property] = [value]
:
.Show
End with
 
M

mrojava

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

Jezebel said:
Have a look at the Help topic 'Built-in Dialog Box Argument Lists'. The
general method is --

With Dialogs(wdDialogFileOpen)
.[Property] = [value]
:
.Show
End with




mrojava said:
I am trying to create a desktop shortcut that will open word and invoke a
macro that does a file/open to a particular folder with a "Files of type"
being All files (*.*). Can someone send me a code fragment for setting
"Files of type". Here is what I've found by example so far. I am not a
programmer.

ChangeFileOpenDirectory "C:\Documents and Settings\Mark\My Documents\Cars"
'Documents.Open FileName:="*.*"
Dialogs(wdDialogFileOpen).Show
' CommandBars.FindControl(ID:=23, Visible:=False).Execute

Uncommenting the Documents.Open Filename generates an error.

Thanks
Mark
 
J

Jezebel

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.




mrojava said:
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

Jezebel said:
Have a look at the Help topic 'Built-in Dialog Box Argument Lists'. The
general method is --

With Dialogs(wdDialogFileOpen)
.[Property] = [value]
:
.Show
End with




mrojava said:
I am trying to create a desktop shortcut that will open word and invoke
a
macro that does a file/open to a particular folder with a "Files of
type"
being All files (*.*). Can someone send me a code fragment for setting
"Files of type". Here is what I've found by example so far. I am not
a
programmer.

ChangeFileOpenDirectory "C:\Documents and Settings\Mark\My
Documents\Cars"
'Documents.Open FileName:="*.*"
Dialogs(wdDialogFileOpen).Show
' CommandBars.FindControl(ID:=23, Visible:=False).Execute

Uncommenting the Documents.Open Filename generates an error.

Thanks
Mark
 
M

mrojava

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

Jezebel said:
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.




mrojava said:
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

Jezebel said:
Have a look at the Help topic 'Built-in Dialog Box Argument Lists'. The
general method is --

With Dialogs(wdDialogFileOpen)
.[Property] = [value]
:
.Show
End with




I am trying to create a desktop shortcut that will open word and invoke
a
macro that does a file/open to a particular folder with a "Files of
type"
being All files (*.*). Can someone send me a code fragment for setting
"Files of type". Here is what I've found by example so far. I am not
a
programmer.

ChangeFileOpenDirectory "C:\Documents and Settings\Mark\My
Documents\Cars"
'Documents.Open FileName:="*.*"
Dialogs(wdDialogFileOpen).Show
' CommandBars.FindControl(ID:=23, Visible:=False).Execute

Uncommenting the Documents.Open Filename generates an error.

Thanks
Mark
 
S

Steve Yandl

Mark,

Try this.

Sub MyFileOpen()
With Dialogs(wdDialogFileOpen)
.Name = "C:\Documents and Settings\Mark\My Documents\Cars"
.Show
End With
End Sub

Steve



mrojava said:
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

Jezebel said:
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.




mrojava said:
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 --

With Dialogs(wdDialogFileOpen)
.[Property] = [value]
:
.Show
End with




I am trying to create a desktop shortcut that will open word and
invoke
a
macro that does a file/open to a particular folder with a "Files of
type"
being All files (*.*). Can someone send me a code fragment for
setting
"Files of type". Here is what I've found by example so far. I am
not
a
programmer.

ChangeFileOpenDirectory "C:\Documents and Settings\Mark\My
Documents\Cars"
'Documents.Open FileName:="*.*"
Dialogs(wdDialogFileOpen).Show
' CommandBars.FindControl(ID:=23, Visible:=False).Execute

Uncommenting the Documents.Open Filename generates an error.

Thanks
Mark
 
M

mrojava

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

Steve Yandl said:
Mark,

Try this.

Sub MyFileOpen()
With Dialogs(wdDialogFileOpen)
.Name = "C:\Documents and Settings\Mark\My Documents\Cars"
.Show
End With
End Sub

Steve



mrojava said:
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

Jezebel said:
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
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 --

With Dialogs(wdDialogFileOpen)
.[Property] = [value]
:
.Show
End with




I am trying to create a desktop shortcut that will open word and
invoke
a
macro that does a file/open to a particular folder with a "Files of
type"
being All files (*.*). Can someone send me a code fragment for
setting
"Files of type". Here is what I've found by example so far. I am
not
a
programmer.

ChangeFileOpenDirectory "C:\Documents and Settings\Mark\My
Documents\Cars"
'Documents.Open FileName:="*.*"
Dialogs(wdDialogFileOpen).Show
' CommandBars.FindControl(ID:=23, Visible:=False).Execute

Uncommenting the Documents.Open Filename generates an error.

Thanks
Mark
 

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