ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open workbook from code without running macros (https://www.excelbanter.com/excel-programming/399868-open-workbook-code-without-running-macros.html)

Ian[_4_]

Open workbook from code without running macros
 
I'm trying to write a routine to update some remote templates by pasting
information from another workbook. The templates are designed to run a
userform to accept input but, for the purposes of the update, I don't want
these to run.

Is there a way to open a template from code in another workbook without
allowing the code in the template to run?

I can see 3 possible options:
1. Stop the code running in the template
2. Allow the template code to run, but automatically actuate the Cancel
button (CommandButton2) on the userform
3. Paste from the workbook to the template without opening the template

I can't find a way to do any of these, nor do I know if they are possible.

I've tried recording a macro in the hope of working through this, but the
part where I click to disable macros when the template opens doesn't produce
any code.

Any pointers will be welcome




joel

Open workbook from code without running macros
 
Changge your ssecuty level in excel to medium. The you will be asked if you
want to run the macros. if your security level is low the macros will
automatically run.

from worksheet menu - Tools - Macro -- Security

"Ian" wrote:

I'm trying to write a routine to update some remote templates by pasting
information from another workbook. The templates are designed to run a
userform to accept input but, for the purposes of the update, I don't want
these to run.

Is there a way to open a template from code in another workbook without
allowing the code in the template to run?

I can see 3 possible options:
1. Stop the code running in the template
2. Allow the template code to run, but automatically actuate the Cancel
button (CommandButton2) on the userform
3. Paste from the workbook to the template without opening the template

I can't find a way to do any of these, nor do I know if they are possible.

I've tried recording a macro in the hope of working through this, but the
part where I click to disable macros when the template opens doesn't produce
any code.

Any pointers will be welcome





Ian[_4_]

Open workbook from code without running macros
 
Thanks, Joel, but the laptops I need to run the updates on are not under my
control. Asking users to change security levels is not a viable option.

Also, for your information, I have security set to medium on my laptop and
the code in my update sheet allows the macros to run anyway.

Bernie's solution works a treat.

Ian

"Joel" wrote in message
...
Changge your ssecuty level in excel to medium. The you will be asked if
you
want to run the macros. if your security level is low the macros will
automatically run.

from worksheet menu - Tools - Macro -- Security

"Ian" wrote:

I'm trying to write a routine to update some remote templates by pasting
information from another workbook. The templates are designed to run a
userform to accept input but, for the purposes of the update, I don't
want
these to run.

Is there a way to open a template from code in another workbook without
allowing the code in the template to run?

I can see 3 possible options:
1. Stop the code running in the template
2. Allow the template code to run, but automatically actuate the Cancel
button (CommandButton2) on the userform
3. Paste from the workbook to the template without opening the template

I can't find a way to do any of these, nor do I know if they are
possible.

I've tried recording a macro in the hope of working through this, but the
part where I click to disable macros when the template opens doesn't
produce
any code.

Any pointers will be welcome








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

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