View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Display an Image in it's associated program

From: Jim Rech )
Subject: Shell command


View this article only
Newsgroups: microsoft.public.excel.programming
Date: 2000/01/14

I don't believe Shell has the capability to run by association, Patrick, but
it's a good thought. There is an API that does run by association though:

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

Global Const SW_SHOWNORMAL = 1

Sub a()
ShellExecute 0, "Open", "c:\Anyfile.txt", "", "C:\", SW_SHOWNORMAL
End Sub
-- Regards,Tom Ogilvy"CB Hamlyn" wrote in message
...
Hello. I've got a program that displays a thumbnail picture of a house's
floorplan within a Userform, based on the house selected by the user.

What
I'd like to do is allow the user to double click on the image and have it
open up in the user's default image viewer, so they might view, edit or
print the floor plan out.

After 2 hours of searching, all I've come up with is the fact that I might
be able to do it with the Shell command but I don't know if that will work
unless I declare the location of the picture viewers exe... which can
obviously changed based on the user's PC.

Any guidance would be very appreciated.

Thank you very much for your time!
CB Hamlyn