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====== 2 10687
On Jan 30, 8:52 am, "John Smith" <some...@microsoft.comwrote:
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.
Thank you... worked great!!!
"JohnH" <Jo**********@gmail.comwrote in message
news:59**********************************@1g2000hs l.googlegroups.com...
On Jan 30, 8:52 am, "John Smith" <some...@microsoft.comwrote:
>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.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Marcel Sammut |
last post by:
Greetings,
I am converting a VB6 application to .net and am having troubles trying to
print a document directley to the printer. My VB6 app used the API
ShellExecute method to accomplish this,...
|
by: Wiktor Zychla |
last post by:
I have a problem I cannot solve.
My application hosts IE activex control. I follow the standard procedure: I
just aximp shdocvw.dll. Note that this gives you two files: axshdocvw.dll
and...
|
by: MCzajk |
last post by:
Is there a function similar to ShellExecute, which I can hook to when the
program is started using Start Menu icon?
MCzajk
|
by: Le, Thanh-Nhan |
last post by:
Hi,
Is there a same function in .Net as API shellexecute?
Thanks
Nhan
|
by: the_openFace |
last post by:
I'm trying to display the shell's property page for various files and I'm
using this code:
class Win32Shell {
// ... other stuff here
public static extern Int32 ShellExecute(
Int32 hwnd,...
|
by: the openBack |
last post by:
I'm trying to display the shell's property page for various files and I'm
using this code:
class Win32Shell {
// ... other stuff here
public static extern Int32 ShellExecute(
Int32 hwnd,...
|
by: David |
last post by:
We have an mfc application in which we use ShellExecute
to launch the browser with an initial web site.
{ShellExecute(
NULL, "open", "http://www.SomeWebSite.com", NULL, NULL,
SW_SHOWNORMAL ) } ...
|
by: fdmaxey |
last post by:
I currently start a target executable written in VB.Net from an
application that uses a C-script language.
I start the target executable using ShellExecute in the C-script. The
target runs fine...
|
by: bugs bunny via .NET 247 |
last post by:
Does anyone have actually used SetWindowsHookEx() to hook upShellExecute() so as to find what application was started bywindows or which folder is currently browsed by explorer. I knowone thing and...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |