Senin, 19 September 2011

[MS_AccessPros] Re: Calling WordPad from Access and file not found

 

David

Shell is a curious creature. It does not handle spaces well. Do this instead, surrounding each string with Chr(34) which is a double-quote:

RetVal = Shell(Chr(34) _
& "C:\Program Files\Windows NT\Accessories\Wordpad.exe " _
& Chr(34) & Chr(34) _
& "C:\Users\David\My Documents\Independent Auto - Help - " _
& "Repair Order.rtf" & Chr(34), 1)

Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile/Bill.Mosca

--- In MS_Access_Professionals@yahoogroups.com, "djsdaddy531" <drtolson@...> wrote:
>
> Great Day, I have created a help file that opens MS WordPad and then I expect the code to open the help file. I use the following code:
>
>
> Private Sub btnHelp_Click()
>
> On Error GoTo Err_btnHelp_Click
>
> Dim RetVal As Long
> RetVal = Shell("C:\Program Files\Windows NT\Accessories\Wordpad.exe " & "C:\Users\David\My Documents\Independent Auto - Help - Repair Order.rtf", 1)
>
> Exit_btnHelp_Click:
> Exit Sub
>
> Err_btnHelp_Click:
> MsgBox Err.Description
> Resume Exit_btnHelp_Click
>
>
> End Sub
>
>
> I receive the WordPad error:
>
> C:\Users\David\My
> Cannot fine this file
> Please verify that the correct path and file name are given.
>
> I have checked the path in the code and to the best of understanding, it appears to be correct. When I open WordPad from the Microsoft Start button, I can open the file.
>
> Thanks in advance for the assistance.
>
> r/David
>

__._,_.___
Recent Activity:
MARKETPLACE
A bad score is 596. A good idea is checking yours at freecreditscore.com.

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

.

__,_._,___

Tidak ada komentar:

Posting Komentar