Rabu, 19 Oktober 2011

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@yahoogroups.com] On Behalf Of djsdaddy531
Sent: Wednesday, October 19, 2011 10:01 PM
To: MS_Access_Professionals@yahoogroups.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

__._,_.___
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