Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2006

Tip: Looking for answers? Try searching our database.

File/Open/Files of Type

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mrojava - 20 Nov 2006 22:43 GMT
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
Jezebel - 20 Nov 2006 23:18 GMT
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"
[quoted text clipped - 11 lines]
> Thanks
> Mark
mrojava - 21 Nov 2006 04:19 GMT
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
Jezebel - 21 Nov 2006 04:39 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.