Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add a button to a macro
At the moment I use a shortcut-key for a macro. Now what I would like is a person to click a button which activates the macro instead of them using the shortcut-key. Code: -------------------- Sub SearchAndOpen() ' ' SearchAndOpen Macro ' Macro recorded 7/07/2006 by Tom Fack ' ' Keyboard Shortcut: Ctrl+r ' Dim s1 As String, bk As Workbook, bk1 As Workbook s1 = "C:\Documents and Settings\" & _ "fackt0\Desktop\Excel Probleem\Shipments\" Set bk = ActiveWorkbook If Dir(s1 & Range("J5").Text & ".xls") < "" Then Set bk1 = Workbooks.Open(s1 & Range("J5").Text & ".xls") bk.Activate Else MsgBox "workbook not found" End If End Sub -------------------- This is one of the examples which uses a shortcut-key at the moment. -- TomBP ------------------------------------------------------------------------ TomBP's Profile: http://www.excelforum.com/member.php...o&userid=36112 View this thread: http://www.excelforum.com/showthread...hreadid=559844 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Use Macro To Change Which Macro Assigned To Command Button | Excel Discussion (Misc queries) | |||
Creating a macro which presses a button containing a recorded macro | Excel Programming | |||
Can't select macro button after other button is pressed | Excel Programming | |||
Pause macro, add form button to sheet, continue macro when button clicked! | Excel Programming | |||
How to end macro on inital active worksheet containing macro button that was clicked | Excel Programming |