Results 1 to 2 of 2

Onkey gone haywire!!!

Threaded View

timatstockers Onkey gone haywire!!! 05-19-2008, 01:21 AM
royUK Please edit your post by... 05-19-2008, 01:28 AM
  1. #1
    Registered User
    Join Date
    01-09-2007
    Posts
    12

    Onkey gone haywire!!!

    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
    Last edited by timatstockers; 05-19-2008 at 02:55 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1