T
TomBP
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
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