Hi,
I am using the following macros and they work fine if I attach it to the f9 key or run them from the vb editor but if I attach it to the shift f9 key the macro stops after it opens the file????? This makes no sense to me!! Any help greatly appreciated
Public Sub Workbook_Open()
Application.OnKey key:="+{F9}", procedure:="RecalcShftF91"
End Sub
Public Sub RecalcShftF91() 'this occurs if they use Shift F9
' Checks whether a file exists
Dim fso
Dim file As String
file = "\\Testing.txt" ' ' file & w/Path
Set fso = CreateObject("Scripting.FileSystemObject")
' Does the file exist?
If Not fso.FileExists(file) Then
GoTo Line1 'If the file doesn't exist
Else 'if the file does exist
Workbooks.OpenText Filename:="\\Testing.txt"
ActiveWorkbook.Close
End If
Line1:
End Sub
Bookmarks