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.
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
>
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
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
>
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.
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
>
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
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks