ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   After module import, code does not work (https://www.excelbanter.com/excel-programming/433706-after-module-import-code-does-not-work.html)

James

After module import, code does not work
 
I have a wb that loads in an external module from another workbook on click
of a button. It then automatically make some changes to the sheets and saves
this workbook as a different filename. Eveything works great untill I execute
the workbook_sheetselectionchange event and try to call MyModule.Thismacro
(which was imported).

If I go into the workbook_sheetselectionchange event and delete the line and
retype it exactly, it works fine!?!?! Anyone know what is going on here?

Any ideas about how to research this or fix would be great. Id like to try
and stay away from writing code to write code in thisworkbook because there
is a good amount. Thanks

Patrick Molloy[_2_]

After module import, code does not work
 
Is it necessary to load a module? If its just the code that you need to run,
it doesn't need to be in the same book - you can save it separately as an xla
and use it whenever required


"James" wrote:

I have a wb that loads in an external module from another workbook on click
of a button. It then automatically make some changes to the sheets and saves
this workbook as a different filename. Eveything works great untill I execute
the workbook_sheetselectionchange event and try to call MyModule.Thismacro
(which was imported).

If I go into the workbook_sheetselectionchange event and delete the line and
retype it exactly, it works fine!?!?! Anyone know what is going on here?

Any ideas about how to research this or fix would be great. Id like to try
and stay away from writing code to write code in thisworkbook because there
is a good amount. Thanks


James

After module import, code does not work
 
yes, Id like to import the modules because they will be accessed alot when
the sheets are being used and the file is saved to another directory on a
network.

what i dont get is that if I simply retype the line "MyModule.Thismacro" ,
it works.

thanks for the reply


"Patrick Molloy" wrote:

Is it necessary to load a module? If its just the code that you need to run,
it doesn't need to be in the same book - you can save it separately as an xla
and use it whenever required


"James" wrote:

I have a wb that loads in an external module from another workbook on click
of a button. It then automatically make some changes to the sheets and saves
this workbook as a different filename. Eveything works great untill I execute
the workbook_sheetselectionchange event and try to call MyModule.Thismacro
(which was imported).

If I go into the workbook_sheetselectionchange event and delete the line and
retype it exactly, it works fine!?!?! Anyone know what is going on here?

Any ideas about how to research this or fix would be great. Id like to try
and stay away from writing code to write code in thisworkbook because there
is a good amount. Thanks


James

After module import, code does not work
 
Is there function that resets the code link to a module? (see below)


I have a wb that loads in an external module from another workbook on click
of a button. It then automatically make some changes to the sheets and saves
this workbook as a different filename. Eveything works great untill I execute
the workbook_sheetselectionchange event and try to call MyModule.Thismacro
(which was imported).

If I go into the workbook_sheetselectionchange event and delete the line and
retype it exactly, it works fine!?!?! Anyone know what is going on here?

Any ideas about how to research this or fix would be great. Id like to try
and stay away from writing code to write code in thisworkbook because there
is a good amount. Thanks



All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com