none
VBA and Macro roblem RRS feed

  • Question

  • I have a macro that exports a module from one workbook and imports it into another. The problem is when I open the new workbook the macro does not run. If I open Visual Basic the module with the code is present, but when I view macros it does not appear.

    The workbook exporting the module is a template to create new workbooks as needed, so I need this to run in each newly created file.

    • Edited by MDevola Thursday, April 4, 2019 1:56 PM
    Thursday, April 4, 2019 1:44 PM

Answers

  • As stated, the first workbook is a template to create multiple workbooks. I need to be able to run a macro to hide certain sheets based on a chosen value in the new workbook. The module has code to run the macro on workbook open. It will run when I go to macros and run it from there, but I need to run on open.
    • Marked as answer by MDevola Tuesday, April 9, 2019 7:24 PM
    Monday, April 8, 2019 2:16 PM

All replies

  • Can you explain why you are doing this.  I'm thinking you should create an addin (.xlam).  The addin contains all code and you select which workbook (.xlsx) to work on.
    Thursday, April 4, 2019 10:43 PM
  • As stated, the first workbook is a template to create multiple workbooks. I need to be able to run a macro to hide certain sheets based on a chosen value in the new workbook. The module has code to run the macro on workbook open. It will run when I go to macros and run it from there, but I need to run on open.
    • Marked as answer by MDevola Tuesday, April 9, 2019 7:24 PM
    Monday, April 8, 2019 2:16 PM