Rabu, 19 Oktober 2011

RE: [MS_AccessPros] How do I open a file in WordPad from a command button

 

David-

Are you able to double-click that file in Windows Explorer? Maybe the file is
actually corrupt. Or maybe you already have the file open somewhere.

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of David Tolson
Sent: Wednesday, October 19, 2011 11:24 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] How do I open a file in WordPad from a command
button

Thanks John, When I try the first method you gave, I get "Cannot open the
specified file," and when I try the second method, I get the same error
that I've always been getting. As I am struggling to open a file from
WordPad, I am wondering of it would make sense to load all of my help files
into a table that has a memo field and open it as a popup form. I think I'll
try it.

Thanks again,

David

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of John Viescas
Sent: Wednesday, October 19, 2011 4:29 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] How do I open a file in WordPad from a command
button

David-

If WordPad is your default program to open .rtf files, then do:

Application.FollowHyperlink
"C:\Users\David\Documents\IndependentAutoHelpRepairOrder.rtf"

If you specifically want to open it in WordPad, and that's not the default
program, then do:

RetVal = Shell("""C:\Program Files\Windows NT\Accessories\Wordpad.exe"" " &
"""C:\Users\David\Documents\IndependentAutoHelpRepairOrder.rtf""", 1)

You can probably get away without surrounding the second argument in quotes
because there are no spaces. But you MUST do that with the first argument,
or
it will try to open "NT\Accessories\Wordpad.exe" with what it finds at
"C:\Program Files\Windows".

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
[mailto:MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of
djsdaddy531
Sent: Wednesday, October 19, 2011 10:01 PM
To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
Subject: [MS_AccessPros] How do I open a file in WordPad from a command
button

Great Day, I am creating helps files in WordPad. When I attempt to open the
file
with the command button, I get the following WordPad error:

C:\Users\David\Documents\IndependedntAutoHelpRepairOrder.rtf
Cannot find this file
Please verify that the correct path and file name are given.

This is the code that I use to try to open the file:

Dim RetVal As String
RetVal = Shell("C:\Program Files\Windows NT\Accessories\Wordpad.exe " &
"C:\Users\David\Documents\IndependentAutoHelpRepairOrder.rtf", 1)

I have been having difficulty locating the proper path name of the file, so
I
went to the windows explorer dialogue box and highlighted the file and held
down
the shift key while right clicking the mouse, and then I clicked "Copy as
Path".
I pasted the path directly to the code.

I am using Access 2007 and saving the files in 2003 version, and I've got
Windows 7 and Office 7 if that helps.

Thanks in advance,

David

------------------------------------

Yahoo! Groups Links

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar