+ Reply to Thread
Results 1 to 14 of 14

After the Windows 11 update, the user form crashes when executing a specific code.

  1. #1
    Registered User
    Join Date
    06-28-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2019
    Posts
    22

    Exclamation After the Windows 11 update, the user form crashes when executing a specific code.

    Hi
    I have a file consisting of an Excel VBA userform, and I have been using it for the last 5 years. It's working fine.

    But 15 days after the Windows 11 updates, a problem arises on 01 of my laptop where the file crashes while running the code. I have checked the code and found that it closes the uppermost user form when the code reaches this line; "Workbooks("Dbase").Close".
    This is another file that does not contain the userform file.

    I have many codes in the userform, but wherever this line occurs, the userform crashes. I have uninstalled this Windows 11 update, but in vain. I reinstalled Windows, and that solved the issue, but now I have the same problem
    with my other system. Can anyone help me with this?

    One of the code is

    Please Login or Register  to view this content.
    .
    .
    .
    Last edited by AliGW; 02-11-2025 at 03:08 AM. Reason: Code tags added - please review the forum guidelines.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,215

    Re: After the Windows 11 update, the user form crashes when executing a specific code.

    Thread moved to the VBA section. Please review the forum guidelines regarding code tags.

    Have you confirmed by uninstalling the Windows update that it is indeed the update that is at fault? I think it unlikely that it would have taken 15 days for this to happen after an update - I would have expected an immediate issue.
    Last edited by AliGW; 02-11-2025 at 03:11 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    06-28-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2019
    Posts
    22

    Re: After the Windows 11 update, the user form crashes when executing a specific code.

    Sorry and thank you to guide me

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,215

    Re: After the Windows 11 update, the user form crashes when executing a specific code.

    Please answer the question I added. Also, you probably need to attach a sample workbook.

  5. #5
    Registered User
    Join Date
    06-28-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2019
    Posts
    22

    Re: After the Windows 11 update, the user form crashes when executing a specific code.

    I'm sorry if I couldn't explain clearly. Fifteen days ago, my laptop had the same issue, and I had to resolve it that day by reinstalling windows Now, after 15 days, I'm facing the same problem with my second system, which occurred after a Windows 11 update just one day ago.
    Last edited by WAQAS79; 02-11-2025 at 03:31 AM.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,215

    Re: After the Windows 11 update, the user form crashes when executing a specific code.

    And what happened after you uninstalled JUST that Windows update? Totally reinstalling Windows does not prove that the update is to blame. You are going to need to be a bit more forensic than this.

    And you need to provide a workbook for testing and very clear instructions about how to recreate the crash. It is all far too vague at the moment.

  7. #7
    Registered User
    Join Date
    12-15-2024
    Location
    Manitoba, Canada
    MS-Off Ver
    2021 & older
    Posts
    6

    Re: After the Windows 11 update, the user form crashes when executing a specific code.

    I'm guessing it's your use of unqualified Range objects. For an interesting read that seems relevant, reconstruct the link above to see how using Range by itself can mess things up. HTH. Dave
    edit: Still not allowed to post links, Google charts tushar-mehta.com/excel/vba/xl_doesn't_quit/#symtom

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

    Re: After the Windows 11 update, the user form crashes when executing a specific code.

    Quote Originally Posted by WAQAS79 View Post
    occurred after a Windows 11 update just one day ago.
    It is very unlikely that any change in Windows will cause your VBA code to start crashing. I can't say it's impossible but I have seen post hoc ergo propter hoc (Fallacy of Cause and Effect) many times. There is almost certainly something else that changed.

    My first question will be whether file Dbase is actually open.

    As Ali says, it will be essential to:

    1. Post your file so we can try to reproduce the problem
    2. Describe the specific steps needed to reproduce the problem
    3. Explain what "crash" means. Does the Excel process terminate? Does it stop responding? Do you get an error message?


    Quote Originally Posted by DavesInoIno View Post
    I'm guessing it's your use of unqualified Range objects. For an interesting read that seems relevant, reconstruct the link above to see how using Range by itself can mess things up. HTH. Dave
    edit: Still not allowed to post links, Google charts tushar-mehta.com/excel/vba/xl_doesn't_quit/#symtom
    Sorry but your link has errors in it. I had to poke around for a while to get the right one.
    http://tushar-mehta.com/excel/vba/xl..._quit/#symptom

    In any case, unqualified Range objects can be a source of bugs, but it seems unlikely that they could cause a crash on trying to close a file.
    Last edited by 6StringJazzer; 02-11-2025 at 01:17 PM. Reason: fixed typo
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  9. #9
    Registered User
    Join Date
    06-28-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2019
    Posts
    22

    Re: After the Windows 11 update, the user form crashes when executing a specific code.

    File Dbase is open as a read only file.

    In this code when I double click on the listbox, it first closes the read only Dbase, then open it as read only false, and update the data to it.

    But now as the code reaches to "Workbooks("Dbase").Close", it also closes the userform and after that rest of code crashes due to this.

    I am unable to understand how to upload my file as it is too much complex and security options also.

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

    Re: After the Windows 11 update, the user form crashes when executing a specific code.

    That is not evident from the code you posted. Nowhere does it re-open the Dbase file. In fact, after a second look I see you close the file, then refer to a worksheet in it after it's closed. That should raise a "subscript not found" error:
    Please Login or Register  to view this content.
    The only way I can imagine this could possibly work is if you have a Change event for CommandButton19 and setting it to True fires the event, and that's where you re-open the file. I normally do not condone causing change events to fire from code, because it obscures what's going on.

    Are you talking about an upgrade to Windows 11 from a prior version, or a maintenance release for W11?

    To sum up, I see nothing in the code you showed us that could cause this problem, and no knowledge of how it could be caused by a Windows update. Without the ability to run your code in your file, we are very limited in what we can do to troubleshoot this. However, I am going to ask that you post the code for the entire UserForm module so we can look for something that you might not think is a problem.

  11. #11
    Registered User
    Join Date
    06-28-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2019
    Posts
    22

    Re: After the Windows 11 update, the user form crashes when executing a specific code.

    Yes, you are right; commandButton19 reopens the database again.
    I will try to recall my problem. I have been using this software for the last five years, and there have been no recent changes. This time, it is running on several systems: Windows 7, Windows 8, Windows 10, and Windows 11. It works fine on every system. However, after installing an update on the Windows 11 system, this problem occurred on the two systems mentioned earlier. Now, I have reinstalled Windows on the second system as well, and the problem is solved.

    I could not understand the problem. One more thing I notice is that whenever I encounter an issue with a Windows app or anything else, I restore Windows to an earlier date. However, after this Windows 11 update, all previous restore points are gone, which forces me to reinstall Windows.

    Thanks you all to help me.

    I want to show you the entire code, but I'm struggling to figure out how to present it, as my codes are very complex and interconnected. I have 10 user forms that are linked to each other, with extensive lines of code.

    Please let me know if there’s any way I can show you my entire project, such as through a video or another method, as I would like to ask for some additional tips.

  12. #12
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,006

    Re: After the Windows 11 update, the user form crashes when executing a specific code.

    Quote Originally Posted by WAQAS79 View Post
    I want to show you the entire code, but I'm struggling to figure out how to present it, as my codes are very complex and interconnected.
    Can you focus just on the part when it crush?
    Never use Merged Cells in Excel

  13. #13
    Registered User
    Join Date
    06-28-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2019
    Posts
    22

    Re: After the Windows 11 update, the user form crashes when executing a specific code.

    Please Login or Register  to view this content.
    when it passes through this line, "Workbooks("Dbase").Close". Dbase file sucessfully close, but unfortunately now this userform also close.
    Last edited by AliGW; 02-12-2025 at 09:05 AM. Reason: Code tags added - please review the forum guidelines.

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,215

    Re: After the Windows 11 update, the user form crashes when executing a specific code.

    Please review the Forum Guidelines regarding code tags. Thanks.

+ 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. Running VBA Code Crashes Windows (Black Screen)
    By GeorgY in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-21-2021, 10:27 AM
  2. Windows 10 update wont run my code!!
    By Jenkins27 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-29-2016, 07:51 AM
  3. Excel 10 crashes under Windows 10 after running VBA code
    By eadamy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-31-2015, 11:57 AM
  4. VBA code not executing upon showing a secondary userform
    By ZilchSr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-16-2015, 07:54 PM
  5. Excel crashes when executing CreateEventProc for Worksheet_Change event
    By 1man in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-03-2014, 05:46 AM
  6. Code works in Windows excel 2003 and 2010 but crashes in Mac excel 2011
    By kiweed in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-19-2012, 08:46 PM
  7. Excel 2007 crashes when executing activeworkbook.close command
    By rpradeepjain in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-10-2010, 07:28 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