Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Aug 2002
    Location
    Brantford, Ontario
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    code interruption (Excel)

    When I run the following:
    If Fc = Fnd Then
    Workbooks.Open Filename:=Fc
    Else
    Workbooks.Open Filename:=Fc
    Workbooks.Open Filename:=Fnd
    End If
    Where Fc and Fnd are string variables representing full path Excel filenames, the code interupts at the End If. When I Continue the code it runs fine until it gets to:
    If Rx = 1 Or Rx = 8 Or Rx = 57 Then
    Windows(Fcc).Activate
    ActiveWorkbook.Save
    Windows(Fcc).Close
    Else
    Windows(Fcc).Activate
    ActiveWorkbook.Save
    ActiveWorkbook.Close
    Windows(Fndc).Activate
    ActiveWorkbook.Save
    ActiveWorkbook.Close
    End If
    where it interrupts again. The pop-up message is the same as when Ctrl+Break is pressed.
    Code is not interrupted if I execute one line at a time using F8.
    What can be causing this problem?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: code interruption (Excel)

    The code runs without interruption when I try it (with names of workbooks existing on my PC). Have you set a breakpoint on the lines where the code stops, now or in the recent past?

  3. #3
    New Lounger
    Join Date
    Aug 2002
    Location
    Brantford, Ontario
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: code interruption (Excel)

    I don't think so, how would I check for that?

    Ron

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: code interruption (Excel)

    If there is a breakpoint now, the line would be highlighted in brown, with a brown bullet in the margin. Sometimes, VBA "remembers" a breakpoint even after it has been removed.

    See if the problem goes away if you use Rob Bovey's Code Cleaner. It's a free download from VBA Code Cleaner.

Posting Permissions

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