+ Reply to Thread
Results 1 to 4 of 4

Macro inexplicably stops after Workbooks.Open

  1. #1
    Registered User
    Join Date
    09-03-2007
    Posts
    2

    Macro inexplicably stops after Workbooks.Open

    I am a novice at excel macro programming.

    My Excel 2000 macro inexplicably stops after the line:

    Workbooks.Open Filename:=stAddrFullname, ReadOnly:=True

    1) I know that the remainder of the code is not executed because a breakpoint on the following line is never reached.
    2) I know that this line is executed because the stAddrFullname workbook is clearly opened and is displayed when the code stops prematurely.
    3) No error message is displayed and I have no 'OnError' instructions in the code.
    4) (This is the bit I really don't understand). If I put a Breakpoint in the macro anywhere in the function preceding the "Workbooks.Open" statement, the macro reaches the Breakpoint and then runs through to completion with no problem. When I remove the breakpoint, it reverts to stopping as soon as it has opened the Workbook.
    5) The stAddrFullname workbook has no macros in it.

    Any ideas please? It is very hard to debug something when the debugging seems to change the sequence of events.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    What is the rest of the code?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    Cross Posted here

  4. #4
    Registered User
    Join Date
    09-03-2007
    Posts
    2

    RE:Macro inexplicably stops after Workbooks.Open

    Apologies for unattributed cross-post on Ozgrid.

    I stripped the code down to the few lines shown below and it is now apparent that the problem is down to how I initiate the code.
    1) From a button it executes ok.
    2) From Macro Shortcut CTRL+J it works ok.
    3) From Macro Shortcut CTRL+SHIFT+J it stops after "Workbooks.Open"

    What is special about CTRL+SHIFT+J and why does it specifically stop after the Open command?

    Please Login or Register  to view this content.

+ 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