+ Reply to Thread
Results 1 to 5 of 5

VBA code hanging in Excel after file delete

  1. #1
    Registered User
    Join Date
    09-02-2014
    Location
    Romania
    MS-Off Ver
    2007
    Posts
    12

    VBA code hanging in Excel after file delete

    Hi,
    I tested a code in a file that disabled sheet delete and rename.
    Now in every Excel file I create or open I can't rename any sheet, if I try Excel tries to open the initial file that had the code and tries to run a module procedure.
    The code was:

    In a sheet:
    Please Login or Register  to view this content.
    In a module:
    Please Login or Register  to view this content.
    Any idea how to get rid of this?
    Thank you in advance!
    Last edited by apophysz; 06-08-2015 at 02:07 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    27,170

    Re: VBA code hanging in Excel after file delete

    The first sub disables the Delete and Rename controls at the application level. You should run the second Sub above to re-enable them. And then you should avoid running code that someone else wrote unless you know exactly what every line is doing.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    09-02-2014
    Location
    Romania
    MS-Off Ver
    2007
    Posts
    12

    Re: VBA code hanging in Excel after file delete

    I ran the Worksheet_Deactivate code in a sub, the Delete option is reset but the Rename option still tries to open the file I tested the code in.

    Update:
    I just ran the reset code for the commandbar and all is back to normal.
    Please Login or Register  to view this content.
    Last edited by apophysz; 06-08-2015 at 12:54 AM.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: [SOLVED] VBA code hanging in Excel after file delete

    Just a note, the correct way to quickly mark thread as solved is to select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    09-02-2014
    Location
    Romania
    MS-Off Ver
    2007
    Posts
    12

    Re: [SOLVED] VBA code hanging in Excel after file delete

    Thank you, I corrected my thread.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA Save Code Intermittment Hanging
    By hobbiton73 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-08-2014, 08:37 AM
  2. VBA code to delete an excel file
    By Stev in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-16-2009, 11:03 AM
  3. VB Code to delete a file
    By JahJr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-25-2009, 10:27 PM
  4. Line of code hanging up on one machine???
    By Don G - ExcelForums.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-21-2005, 06:06 PM
  5. charting code hanging up
    By Papa Jonah in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2005, 01:06 AM

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