Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Other Programs Using Pictures as Buttons 1

Status
Not open for further replies.

krnsmartazz

Technical User
Dec 13, 2001
134
0
0
US
How can I use pictures as buttons to open another program. For instance if I use a music note I can open itunes etc..
Thanks
 
If you place an image on the form, such as a musical note, the image will have a "click" and "double click" event in the property box. You can then execute code by clicking on the image. The Shell function will launch an external program. Simply place "shell" into the Access Help Box for details. If your image is named imgMusicNote, for example, clicking on it will cause (in this example) the Windows Calculator to be run:

Private Sub imgMusicNote_Click()

'Specifying 1 as the second argument opens the application 'in normal size and gives it the focus.

Dim RetVal

RetVal = Shell("C:\WINDOWS\CALC.EXE", 1) ' Runs Calculator.

End Sub


Simply substitute the path and program name to the exe file you wish to run!

The Missinglinq

There's ALWAYS more than one way to skin a cat!
 
How can i make it so that the window will maximize when it opens?
 
RetVal = Shell("C:\WINDOWS\CALC.EXE", vbMaximizedFocus)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top