ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Display an Image in it's associated program (https://www.excelbanter.com/excel-programming/323157-display-image-its-associated-program.html)

CB Hamlyn

Display an Image in it's associated program
 
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



Tom Ogilvy

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





CB Hamlyn

Display an Image in it's associated program
 
I had to make the declarations private, but other than that it works
perfectly.

Thank you so much Tom :)

CB Hamlyn

"Tom Ogilvy" wrote in message
...
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








All times are GMT +1. The time now is 10:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com