+ Reply to Thread
Results 1 to 3 of 3

Double Click to open external program

  1. #1
    Darren Hill
    Guest

    Double Click to open external program


    I have an image on my worksheet. This image changes based on the
    activecell.
    I'd like to be able to double click that image control, and have my
    imagebrowser program (IrfanView) open with the image ready to be edited.

    At the moment, I've tried the following:

    Private Sub ImageBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    Dim myPicture As String, ImageID

    myPicture = Range("C" & ActiveCell.Row).Value
    ' column C includes the file paths of the images
    MsgBox (myPicture)
    ImageID = Shell("C:\Program Files\IrfanView\i_view32.exe" & myPicture,
    1)
    'ImageID = Shell(myPicture, 1)

    End Sub

    I've tested the filepaths are accurate using hyperlinks.

    Thanks in advance for any ideas.

    Darren

  2. #2
    Robin Hammond
    Guest

    Re: Double Click to open external program

    Darren,

    I have not idea about passing parameters to irfanview, but what you can do
    is run the file at a given path in its default program using the
    ShellExecute API call.

    ie.

    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

    Sub Test()
    mypicture = "C:\Images\Image1.jpg"
    lReturn = ShellExecute(0, "", mypicture, "", "", 0)
    End Sub

    HTH,

    Robin Hammond
    www.enhanceddatasystems.com

    "Darren Hill" <[email protected]> wrote in message
    news:opsnehmwbked89cl@omega...
    >
    > I have an image on my worksheet. This image changes based on the
    > activecell.
    > I'd like to be able to double click that image control, and have my
    > imagebrowser program (IrfanView) open with the image ready to be edited.
    >
    > At the moment, I've tried the following:
    >
    > Private Sub ImageBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    > Dim myPicture As String, ImageID
    >
    > myPicture = Range("C" & ActiveCell.Row).Value
    > ' column C includes the file paths of the images
    > MsgBox (myPicture)
    > ImageID = Shell("C:\Program Files\IrfanView\i_view32.exe" & myPicture,
    > 1)
    > 'ImageID = Shell(myPicture, 1)
    >
    > End Sub
    >
    > I've tested the filepaths are accurate using hyperlinks.
    >
    > Thanks in advance for any ideas.
    >
    > Darren




  3. #3
    Darren Hill
    Guest

    Re: Double Click to open external program

    That works a charm.
    Thanks, Robin

    Darren

    On Thu, 10 Mar 2005 13:18:07 +0800, Robin Hammond
    <[email protected]> wrote:

    > Darren,
    >
    > I have not idea about passing parameters to irfanview, but what you can
    > do
    > is run the file at a given path in its default program using the
    > ShellExecute API call.
    >
    > ie.
    >
    > 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
    >
    > Sub Test()
    > mypicture = "C:\Images\Image1.jpg"
    > lReturn = ShellExecute(0, "", mypicture, "", "", 0)
    > End Sub
    >
    > HTH,
    >
    > Robin Hammond
    > www.enhanceddatasystems.com
    >
    > "Darren Hill" <[email protected]> wrote in message
    > news:opsnehmwbked89cl@omega...
    >>
    >> I have an image on my worksheet. This image changes based on the
    >> activecell.
    >> I'd like to be able to double click that image control, and have my
    >> imagebrowser program (IrfanView) open with the image ready to be edited.
    >>
    >> At the moment, I've tried the following:
    >>
    >> Private Sub ImageBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    >> Dim myPicture As String, ImageID
    >>
    >> myPicture = Range("C" & ActiveCell.Row).Value
    >> ' column C includes the file paths of the images
    >> MsgBox (myPicture)
    >> ImageID = Shell("C:\Program Files\IrfanView\i_view32.exe" &
    >> myPicture,
    >> 1)
    >> 'ImageID = Shell(myPicture, 1)
    >>
    >> End Sub
    >>
    >> I've tested the filepaths are accurate using hyperlinks.
    >>
    >> Thanks in advance for any ideas.
    >>
    >> Darren

    >
    >




    --
    Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1