+ Reply to Thread
Results 1 to 7 of 7

Thread: Multiple Modules in the same workbook?

  1. #1
    Registered User
    Join Date
    06-20-2006
    Posts
    22

    Multiple Modules in the same workbook?

    Is there problems with having more than one module in a workbook.

    I've created a second module because I need to 'Sub DeleteModule()' for one of them because it contains the 'Sub Auto_Open()' which I don't want to carry over when I SaveAs.

    Both modules ("module1", "B4Close") are in the same Workbook.

  2. #2
    Norman Jones
    Guest

    Re: Multiple Modules in the same workbook?

    Hi Kartune85,

    > Is there problems with having more than one module in a workbook.


    No. Indeed it is often desirable.


    ---
    Regards,
    Norman



    "kartune85" <kartune85.29zo21_1151290803.3141@excelforum-nospam.com> wrote
    in message news:kartune85.29zo21_1151290803.3141@excelforum-nospam.com...
    >
    > Is there problems with having more than one module in a workbook.
    >
    > I've created a second module because I need to 'Sub DeleteModule()' for
    > one of them because it contains the 'Sub Auto_Open()' which I don't want
    > to carry over when I SaveAs.
    >
    > Both modules ("module1", "B4Close") are in the same Workbook.
    >
    >
    > --
    > kartune85
    > ------------------------------------------------------------------------
    > kartune85's Profile:
    > http://www.excelforum.com/member.php...o&userid=35586
    > View this thread: http://www.excelforum.com/showthread...hreadid=555446
    >




  3. #3
    Registered User
    Join Date
    06-20-2006
    Posts
    22

    Procedure not executing

    The main procedures are located in "module1" (and accessed/referenced from a Userform) and then that module is deleted (from within the Userform), and I need 'Private Sub Workbook_BeforeClose()' to run from module "B4Close" when the user goes to close the workbook. But it's not executing the code.

    Any idea's on what the problem might be? My Form is so close to completion!

    Thanks,

    Kartune85

  4. #4
    Ardus Petus
    Guest

    Re: Multiple Modules in the same workbook?

    Private Sub Workbook_BeforeClose() MUST be located in ThisWorkbook module,
    not B4Close.

    HTH
    --
    AP

    "kartune85" <kartune85.29zvxb_1151301004.0231@excelforum-nospam.com> a écrit
    dans le message de news:
    kartune85.29zvxb_1151301004.0231@excelforum-nospam.com...
    >
    > The main procedures are located in "module1" (and accessed/referenced
    > from a Userform) and then that module is deleted (from within the
    > Userform), and I need 'Private Sub Workbook_BeforeClose()' to run from
    > module "B4Close" when the user goes to close the workbook. But it's not
    > executing the code.
    >
    > Any idea's on what the problem might be? My Form is so close to
    > completion!
    >
    > Thanks,
    >
    > Kartune85
    >
    >
    > --
    > kartune85
    > ------------------------------------------------------------------------
    > kartune85's Profile:
    > http://www.excelforum.com/member.php...o&userid=35586
    > View this thread: http://www.excelforum.com/showthread...hreadid=555446
    >




  5. #5
    Registered User
    Join Date
    06-20-2006
    Posts
    22

    Activate Other Module?

    Is there a way of activating the second module and making it the module for 'ThisWorkbook' because I need to delete "module1" so that when I use 'SaveAs' for the workbook, 'Sub Auto_Open()' doesn't get carried across.

  6. #6
    Ardus Petus
    Guest

    Re: Multiple Modules in the same workbook?

    I fear you can't do that.

    Maybe you can edit (delete) part of the ThisWorkbook module

    --
    AP

    "kartune85" <kartune85.2a00bo_1151306703.4338@excelforum-nospam.com> a écrit
    dans le message de news:
    kartune85.2a00bo_1151306703.4338@excelforum-nospam.com...
    >
    > Is there a way of activating the second module and making it the module
    > for 'ThisWorkbook' because I need to delete "module1" so that when I
    > use 'SaveAs' for the workbook, 'Sub Auto_Open()' doesn't get carried
    > across.
    >
    >
    > --
    > kartune85
    > ------------------------------------------------------------------------
    > kartune85's Profile:
    > http://www.excelforum.com/member.php...o&userid=35586
    > View this thread: http://www.excelforum.com/showthread...hreadid=555446
    >




  7. #7
    Bob Phillips
    Guest

    Re: Multiple Modules in the same workbook?

    If you want to run BeforeClose from another procedure, why not strip the
    code out from there and insert in procedure in the module, and call that new
    procedure from B4Close and from the Workbook_BeforeClose?

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "kartune85" <kartune85.29zvxb_1151301004.0231@excelforum-nospam.com> wrote
    in message news:kartune85.29zvxb_1151301004.0231@excelforum-nospam.com...
    >
    > The main procedures are located in "module1" (and accessed/referenced
    > from a Userform) and then that module is deleted (from within the
    > Userform), and I need 'Private Sub Workbook_BeforeClose()' to run from
    > module "B4Close" when the user goes to close the workbook. But it's not
    > executing the code.
    >
    > Any idea's on what the problem might be? My Form is so close to
    > completion!
    >
    > Thanks,
    >
    > Kartune85
    >
    >
    > --
    > kartune85
    > ------------------------------------------------------------------------
    > kartune85's Profile:

    http://www.excelforum.com/member.php...o&userid=35586
    > View this thread: http://www.excelforum.com/showthread...hreadid=555446
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0