View Full Version : Show Image with VB Code

11-02-2006, 12:28 AM
hey all, just wondering if anyone knows a way that when a command button is pressed a image will open? can taht be done?
-Jez Out

11-02-2006, 01:39 AM
In an Office application or its own?
For the latter try

Private Sub CommandButton1_Click()
Dim MyFile As String, Cmd As String
MyFile = "C:\AAA\MyChartA.jpg"
Cmd = "RunDLL32.EXE shell32.dll,ShellExec_RunDLL "
Shell (Cmd & MyFile)
End Sub

11-02-2006, 01:50 AM
in its own program...
i need it to store the file in the .exe and display it when a command button is pressed, i can use it to link to the picture on the net but i am trying to make the command button invisible... any way to do that and have it clickable and all?
-Jez out

11-06-2006, 05:27 PM
I don't believe you can click an invisible button, but I seem to recall you can make a rectangle clickable, and you could "hide" it by removing the border and making it the same colour as the background.

11-09-2006, 04:53 AM
Could you explain a bit more what you are trying to do? I am not following.
i need it to store the file in the .exe and display it when a command button is pressed"Store the file in the .exe".

Uh...say what? Ummmm, what has this to do with VBA? It does not make sense. Please elaborate.

11-13-2006, 01:08 PM
AutoCAD allows you also to run an app or two from the command line, like "browser" command, but you can set your own. You could make your button like 98% transparent, and still click it. the are api's and alot of examples