+ Reply to Thread
Results 1 to 11 of 11

running VBA disables all other open workbooks

  1. #1
    Registered User
    Join Date
    02-19-2017
    Location
    Adelaide, Australia
    MS-Off Ver
    16
    Posts
    19

    Question running VBA disables all other open workbooks

    Good Morning, quick question please.
    I have 2 workbooks open with data, no code. Then when I open another workbook and run VBA code from auto_open, it locks all my opened workbook.
    Is it possible to stop this behaviour, so that VBA code only pertains to its own workbook, and user can still browse/edit different unrelated workbooks?
    Many thanks in advance
    jack

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: running VBA disables all other open workbooks

    Check your auto_open workbook code. If it says "ActiveWorkbook" in your code, it may be confused which book is active.

    Consider changing to "ThisWorkbook".

    I believe since Excel 2010, when a new workbook is opened, each one is an individually new running instance of Excel. In essence, each workbook is separate from each other.
    Make certain each workbook is running in a separate instance of Excel ?

    Of course sharing your code would help immensely.

  3. #3
    Registered User
    Join Date
    02-19-2017
    Location
    Adelaide, Australia
    MS-Off Ver
    16
    Posts
    19

    Re: running VBA disables all other open workbooks

    Hi there and many thanks for your quick reply.
    Code is really simple - I bring up a user-defined form, please see below. I already check if it's ThisWorkBook.... any other properties I could amend?

    Please Login or Register  to view this content.
    Administrative Note:
    • Please see Forum Rule #3 about the proper use of code tags...
    • Added for you this time, but please use them in the future…Thanks.
    Last edited by jeffreybrown; 02-19-2017 at 09:46 PM. Reason: Code Tags

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: running VBA disables all other open workbooks

    Throwing out a guess here ...

    Will your project work if you change :

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-19-2017
    Location
    Adelaide, Australia
    MS-Off Ver
    16
    Posts
    19

    Re: running VBA disables all other open workbooks

    Hi, no difference.
    I tried creating vba project from scratch. Then in module I just bring up empty form using show. And it lock all other opened workbooks.
    Must be a setting somewhere, but I don't know enough about it. Many thanks for your help.

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: running VBA disables all other open workbooks

    Opening a form shouldn't have that effect. There must be something in the code within the form that is causing the error.

    I don't know enough about
    Please Login or Register  to view this content.
    to be able to speak about it. However, you are only
    referencing the OLE DB module. Not certain how that would affect anything.

    At least you mentioning that the error occurs when you open the form ... that narrows it down a little.

    If you use OPTION EXPLICIT at the top of all of your macros, that will help to point out any errors in your code.

    If you also have ON ERROR RESUME NEXT in your macros ... comment that line out so your project won't bypass any errors.

    If you are familiar with stepping through your code, do that as well. Oftentimes after disabling ON ERROR RESUME NEXT and stepping through your code
    will help to pin down the offending line in the code. In case you don't understand "stepping through your code" ...

    Please Login or Register  to view this content.
    If you are aware of stepping through the code .. I apologize for preaching to the choir.

    Providing some error messages will help with this effort.

    Any one else want to join in the conversation to help ?

  7. #7
    Registered User
    Join Date
    02-19-2017
    Location
    Adelaide, Australia
    MS-Off Ver
    16
    Posts
    19

    Re: running VBA disables all other open workbooks

    Hi, to make things simpler I started new project, with 1 module that does frm01.show, and 1 blank form frm01 that's being shown. With option explicit. No other code.
    Stepping through - loads a form, as soon as form loads - all other previously opened workbooks are frozen. And I can't open any new workbooks.
    So is this intended behaviour?

  8. #8
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: running VBA disables all other open workbooks

    "So is this intended behaviour?" .... No

    Sometimes my computer does strange things when I repeatedly open a form in a project I am building. Especially if, while running the project to test it and I use the CTRL / BREAK keys to stop
    a macro from running.

    The only way I can get around it is to save my work, close everything down and re-boot the computer. Then it runs smoothly again until I use CTRL / BREAK too often again.

  9. #9
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: running VBA disables all other open workbooks

    It's late here now. About 10 pm.

    See what you can get done. I'll check back in the morning.

    Cheers

  10. #10
    Registered User
    Join Date
    02-19-2017
    Location
    Adelaide, Australia
    MS-Off Ver
    16
    Posts
    19

    Re: running VBA disables all other open workbooks

    Hi there, got it, problem was with the userform itself - it was set to Modal. Thanks for your help, I should have known this. Cheers.

  11. #11
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: running VBA disables all other open workbooks

    Ha ! And all along my mind was focused on a corrupt workbook or incorrect syntax.

    I'm beating my head against the wall repeating "It's the simple stuff, stupid. It's the simple stuff, stupid."

    So glad you got it ironed out.

    Cheers mate !

+ 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] Code stops running at workbooks.open statement
    By skonduru in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-31-2016, 02:37 PM
  2. Replies: 1
    Last Post: 03-31-2016, 02:06 AM
  3. Running workbooks.open to open pax-protected file still prompts for a password
    By karinincanada in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-24-2015, 05:06 PM
  4. [SOLVED] Timer loop in one workbook disables other workbooks from being edited
    By mason0567 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-06-2015, 03:43 PM
  5. [SOLVED] Macros not running unless Workbooks are opened with File>Open
    By Benjooster in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-12-2013, 11:02 AM
  6. [SOLVED] Open workbooks update the main one and close the other workbooks
    By stojko89 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2013, 07:12 AM
  7. [SOLVED] Open Multiple Workbooks, Record names, Copy paste to Active Workbook, Close the Workbooks
    By vba_madness in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2013, 06:09 AM

Tags for this Thread

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