+ Reply to Thread
Results 1 to 4 of 4

Delete Form, Module and This Workbook code (Run Once)

  1. #1
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Delete Form, Module and This Workbook code (Run Once)

    Good day,
    I have searched briefly and nothing to my liking. Looking for some information on the following:

    I have a Userform that will send information to my Sheet that will be hidden. I will also have a "on Workbook_Open" to call this Userform. (frmopen.Show)

    This userform must be deleted after the information is unloaded. Therefore the userform will be initiated on open, and once the information is inserted (commandbutton1_click in my frmopen) in my sheet, the Userform must be deleted but also the Workbook_Open / frmopen.Show.

    Could someone please point me to the right direction or send me a link so I can figure this out.

    Thank you,
    ExcelNoub

  2. #2
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: Delete Form, Module and This Workbook code (Run Once)

    this code will delete all code from your workbook (I am not sure about the userform). try it:
    Please Login or Register  to view this content.
    Click on the star if you think I helped you

  3. #3
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: Delete Form, Module and This Workbook code (Run Once)

    Thank you Adyteo,
    I will try to figure this out and only delete a certain (frmadmin) module and not all modules.

    Excelnoub

  4. #4
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: Delete Form, Module and This Workbook code (Run Once)

    I found a workaround here is what I have come up with and seems to work perfectly:

    Code in my ThisWorkbook
    Please Login or Register  to view this content.
    Code in my Userform1:
    Please Login or Register  to view this content.
    Code in Module1,2 and 3

    Please Login or Register  to view this content.

    What the code is doing is... On Workbook open, loading my Userform1 so I can add information to my sheet (for info only), then deleting my "ThisWorkbook" code in its entirety, Then it will add a new code in my "ThisWorkbook" that will add to open Userform2.

    Then I am calling to Delete all Modules 1 2 3. Will fine tune this code so I have everything in Module1 and I will only have to delete Module1 at the end


    ExcelNoub

+ 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. how to access Sheet module, normal module, Worbook module to type code
    By alibaba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2009, 07:51 AM
  2. How to copy module form one workbook to another
    By deepakmehta in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-08-2006, 05:10 PM
  3. Run worksheet module code from workbook module?
    By keithb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2005, 12:05 AM
  4. [SOLVED] re: Automatically Delete WorkBook 2 modules by using Workbook 1 module
    By ddiicc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-27-2005, 08:05 AM
  5. Replies: 1
    Last Post: 04-10-2005, 07:07 PM

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