Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Open workbook from code without running macros

Ian,

Turn off events:

Application.EnableEvents = False
Workbooks.Open "C:\Folder\FileName.xls"
Application.EnableEvents = True

HTH,
Bernie
MS Excel MVP


"Ian" wrote in message ...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default Open workbook from code without running macros

That easy, eh?

Thanks, Bernie.

Ian

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Ian,

Turn off events:

Application.EnableEvents = False
Workbooks.Open "C:\Folder\FileName.xls"
Application.EnableEvents = True

HTH,
Bernie
MS Excel MVP


"Ian" wrote in message
...
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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running Macros in a protected workbook Christian Excel Discussion (Misc queries) 1 July 19th 09 01:37 PM
Open workbook without running Macros Raul[_2_] Excel Programming 2 May 27th 06 02:51 PM
running macros/vba code in a shared environment Eric[_27_] Excel Programming 1 January 25th 05 11:27 AM
Running Macros in protected workbook petunia Excel Worksheet Functions 3 January 18th 05 09:24 PM
Running macros from another workbook [email protected] Excel Programming 4 November 21st 03 11:04 PM


All times are GMT +1. The time now is 09:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"