ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I run a macro from a .xlt file (https://www.excelbanter.com/excel-programming/303652-how-do-i-run-macro-xlt-file.html)

Vinnie

How do I run a macro from a .xlt file
 
My program (Test.xlt) has code which opens another workbook (Calc.xlt) & then runs a macro from Calc.xlt.
My problem is that everytime the code runs, Calc.xlt opens as Calc1 & the next time as Calc2 & then Calc3 etc. This means the macro from within isn't recognised because my code refers to Openfile - Calc.xlt. and not Calc1, Calc2 etc.

How do I amend my code so that when Calc.xlt is opened, the macro is recognised as Calc1!RunMacro or Calc2!RunMacro or Calc3!RunMacro

Thanks

Tom Ogilvy

How do I run a macro from a .xlt file
 
make your workbook a normal workbook rather than a template.

--
Regards,
Tom Ogilvy

"Vinnie" wrote in message
...
My program (Test.xlt) has code which opens another workbook (Calc.xlt) &

then runs a macro from Calc.xlt.
My problem is that everytime the code runs, Calc.xlt opens as Calc1 & the

next time as Calc2 & then Calc3 etc. This means the macro from within isn't
recognised because my code refers to Openfile - Calc.xlt. and not Calc1,
Calc2 etc.

How do I amend my code so that when Calc.xlt is opened, the macro is

recognised as Calc1!RunMacro or Calc2!RunMacro or Calc3!RunMacro

Thanks




Vinnie

How do I run a macro from a .xlt file
 
Thanks Tom, however for the purposes of this project I need to keep the files as templates. Any other suggestions?

"Tom Ogilvy" wrote:

make your workbook a normal workbook rather than a template.

--
Regards,
Tom Ogilvy

"Vinnie" wrote in message
...
My program (Test.xlt) has code which opens another workbook (Calc.xlt) &

then runs a macro from Calc.xlt.
My problem is that everytime the code runs, Calc.xlt opens as Calc1 & the

next time as Calc2 & then Calc3 etc. This means the macro from within isn't
recognised because my code refers to Openfile - Calc.xlt. and not Calc1,
Calc2 etc.

How do I amend my code so that when Calc.xlt is opened, the macro is

recognised as Calc1!RunMacro or Calc2!RunMacro or Calc3!RunMacro

Thanks





Tom Ogilvy

How do I run a macro from a .xlt file
 
Sure, understand how templates work and code accordingly.

--
Regards,
Tom Ogilvy


"Vinnie" wrote in message
...
Thanks Tom, however for the purposes of this project I need to keep the

files as templates. Any other suggestions?

"Tom Ogilvy" wrote:

make your workbook a normal workbook rather than a template.

--
Regards,
Tom Ogilvy

"Vinnie" wrote in message
...
My program (Test.xlt) has code which opens another workbook (Calc.xlt)

&
then runs a macro from Calc.xlt.
My problem is that everytime the code runs, Calc.xlt opens as Calc1 &

the
next time as Calc2 & then Calc3 etc. This means the macro from within

isn't
recognised because my code refers to Openfile - Calc.xlt. and not Calc1,
Calc2 etc.

How do I amend my code so that when Calc.xlt is opened, the macro is

recognised as Calc1!RunMacro or Calc2!RunMacro or Calc3!RunMacro

Thanks








All times are GMT +1. The time now is 12:23 PM.

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