This is part of the Windows API. Excel/VBA know nothing about it, so you
have include the declarations that I included, in the top section of the
code module:
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
Const SW_SHOWNORMAL = 1
NickHK
"videor" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks for the additional ideas. I got the IE version to work, and the
Image
> control. However, I can't get the ShellExecute to work. The statement
> "retval=shellexecute(..." crashes with a "object doesn't support this
> property or method" message. the entire statement is highlighted.
>
> bern muller
>
>
> "NickHK" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > You have a few choices.
> > .FollowHyperlink will open it in IE.
> > The ShellExecute API will open in the app associated with that file
type.
> >
> > 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
> > Const SW_SHOWNORMAL = 1
> >
> > Private Sub CommandButton3_Click()
> > Dim RetVal As Long
> >
> > Const FileName As String = "C:\Sample.jpg"
> >
> > ThisWorkbook.FollowHyperlink FileName
> > 'or
> > RetVal = ShellExecute(Application.hwnd, "open", FileName, vbNullString,
> > "C:\", SW_SHOWNORMAL)
> >
> > End Sub
> >
> > Or you could keep it all inside Excel, by using an Image control (on the
> > WS
> > or modeless userform) and load the picture into that.
> > That way it is not saved with the WB.
> >
>
>
|