+ Reply to Thread
Results 1 to 11 of 11

How to delete a private sub macro?

  1. #1
    Forum Contributor
    Join Date
    05-21-2014
    Location
    United States
    MS-Off Ver
    Office 365 on Windows 10
    Posts
    122

    Question How to delete a private sub macro?

    My Excel refuses to open maximized no matter what I do, so I found a macro on Microsoft.com that is supposed to fix the problem (below) but it didn't work.

    Now I have 2 blank modules in my list of modules and I can't find any way to delete them. I deleted the coding from both modules but they still show up on the list. How do I get rid of them permanently?

    They don't appear on my list of macros (just list of modules) - I presume it's because they are private sub macros.

    Here is the macro I tried using to get it to open maximized.


    Please Login or Register  to view this content.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: How to delete a private sub macro?

    Hi, MetroBOS,

    the code you found should go into ThisWorkbook, not any standard module. Right-click on the standard module in the project explorer in the VBE (CTRL+G) to delete the module, mark the code and press delete to delete the procedure. Be sure to save the file when closing the workbook.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to delete a private sub macro?

    Quote Originally Posted by MetroBOS View Post
    My Excel refuses to open maximized no matter what I do, so I found a macro on Microsoft.com that is supposed to fix the problem (below) but it didn't work.
    Quite probably because the code needed to be in the ThisWorkbook code module, not a regular module.
    Remember what the dormouse said
    Feed your head

  4. #4
    Forum Contributor
    Join Date
    05-21-2014
    Location
    United States
    MS-Off Ver
    Office 365 on Windows 10
    Posts
    122

    Re: How to delete a private sub macro?

    I don't want to save it to a specific workbook though. I want it to work every time I open Excel, and when I open Excel, it automatically opens PERSONAL.XLSB.

    Is the reason why Excel will not open maximized related to the fact that I have Macros saved under PERSONAL.XLSB?

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to delete a private sub macro?

    You need to put the code into the ThisWorkbook module of personal.Xlsb so that it runs whenever Excel is opened.

  6. #6
    Forum Contributor
    Join Date
    05-21-2014
    Location
    United States
    MS-Off Ver
    Office 365 on Windows 10
    Posts
    122

    Re: How to delete a private sub macro?

    Thanks guys, I'll give it a try.

  7. #7
    Forum Contributor
    Join Date
    05-21-2014
    Location
    United States
    MS-Off Ver
    Office 365 on Windows 10
    Posts
    122

    Re: How to delete a private sub macro?

    I seem to be having some trouble here. How do I put it into the ThisWorkbook module?

  8. #8
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to delete a private sub macro?

    Double-click the ThisWorkbook object in the Project Explorer in the VB editor, then put the code into the code window that appears.

  9. #9
    Forum Contributor
    Join Date
    05-21-2014
    Location
    United States
    MS-Off Ver
    Office 365 on Windows 10
    Posts
    122

    Re: How to delete a private sub macro?

    Brilliant! Thanks everyone for sticking with me on this - seems to be working fine now.

  10. #10
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to delete a private sub macro?

    Glad to help - I remember how much that 'feature' used to annoy me!

  11. #11
    Registered User
    Join Date
    05-29-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: How to delete a private sub macro?

    I started having a problem today with excel opening multiple instances of excel and i think i traced it back to this problem from years ago. I too added in a private sub in my personal.xlsb workbook. This was not done as a module, but rather an event (that the right name?) where the VBA dropdowns list it as Workbook and Open. How do I get rid of this now? I delete the code and it just comes back...

+ 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. Delete worksheet private sub after paste
    By ozizushi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-20-2014, 05:17 PM
  2. Vba that copy to a new tab but delete the private sub in the new tab
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-20-2013, 01:16 PM
  3. [SOLVED] delete private sub with code
    By jed38 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-10-2013, 10:10 AM
  4. Replies: 3
    Last Post: 07-30-2013, 01:38 AM
  5. macro to delete row containing "private" then rows beneath upto blank row
    By Wagstaff in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-24-2010, 01:14 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