Re: ShellExecute API
- From: "John Smith" <someone@xxxxxxxxxxxxx>
- Date: Wed, 30 Jan 2008 15:45:08 -0500
Thank you... worked great!!!
"JohnH" <JohnHarris34@xxxxxxxxx> wrote in message
news:596279aa-2689-4dc5-b378-0408f5b85aeb@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Jan 30, 8:52 am, "John Smith" <some...@xxxxxxxxxxxxx> wrote:
Hi,
I have an access database form with an image. I'm trying to create an
onclick event on the image so that when a user clicks on the image it
opens
that file with the default viewer the computer is set on. I've searched
the
web and nothing solid. I did get the following VBA code and it doesn't
seem
to work. If anyone can help me i'd appreciate it. From the code below
txtImageNote is a field on the form that displays the path to the image
with
is working properly.
=====BEGIN=====
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As
String,
ByVal nShowCmd As Long) As Long
Private Sub imageFrame_Click()
Dim strImageName As String
strImageName = Me!txtImageNote
ShellExecute 0, vbNullString, strImageName, vbNullString,
vbNullString,
vbNormalFocus
End Sub
=====END======
This works for me:
Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String,
ByVal lpFile As String, ByVal lpParameters As String, ByVal
lpDirectory As String, ByVal nShowCmd As Long) As Long
----
ShellExecute 0&, vbNullString, sPath, vbNullString, vbNullString,
vbNormalFocus
----
...where sPath is a full valid path to a file.
.
- References:
- ShellExecute API
- From: John Smith
- Re: ShellExecute API
- From: JohnH
- ShellExecute API
- Prev by Date: Re: Aggregate string concatenation efficiency problem
- Next by Date: Re: Aggregate string concatenation efficiency problem
- Previous by thread: Re: ShellExecute API
- Next by thread: Aggregate string concatenation efficiency problem
- Index(es):
Relevant Pages
|
Loading