+ Reply to Thread
Results 1 to 2 of 2

Code works when stepping through, but cuts out when run

  1. #1
    Registered User
    Join Date
    04-21-2005
    Posts
    2

    Code works when stepping through, but cuts out when run

    I have a sheet with names of files, and next to it numbers for passwords, like this:

    Anneke-Coetzer.xls 5913 5340

    Now if I step through this with F8 while in debug mode this code works. But when I run it (using my shortcut key), it doesn't... I believe it's because the sheet that opens gains focus, and it breaks the current macro.

    Please Login or Register  to view this content.
    Can anybody help me as to how I can get it to work when I press my shortcut key for this macro?

  2. #2
    Registered User
    Join Date
    04-21-2005
    Posts
    2
    I changed the code to this:

    If TryOpen("K:\Stats\2005\test\CO\" & FileToSave) Then

    ' NewFile is opened
    MsgBox (ActiveBook.Name)
    ProtectAllSheetsAuto (SheetPass)
    ... other code...
    Else
    MsgBox ("Failed to open " & FileToSave)
    End If

    and when I run it normally NEITHER of the MsgBoxes are shown.

+ Reply to Thread

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