Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
grasping@straws
 
Posts: n/a
Default Can macro/userform run depending on HOW workbook is opened?

I'd like to show a userform (and/or run a macro) when I open my
Template Wizard database workbook...but NOT have it run when Excel
opens it in the background to copy new records or update existing
ones...any way to do this?

tm
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

If you put your code to show the form in Auto_open() (in a general module), then
that'll run when the workbook is opened manually.

If you open the workbook via code, it won't run (unless you run it explicitly,
see RunAutoMacros in VBA's help for more info).

Alternatively, you could put your code behind ThisWorkbook (workbook_open).

This code will run unless you stop it and you can stop it by disabling events:

application.enableevents = false
'your code to open the other workbook
application.enableevents = true



"grasping@straws" wrote:

I'd like to show a userform (and/or run a macro) when I open my
Template Wizard database workbook...but NOT have it run when Excel
opens it in the background to copy new records or update existing
ones...any way to do this?

tm


--

Dave Peterson
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
Creating a subbook from a workbook. Chaplain Doug Excel Discussion (Misc queries) 0 December 19th 04 11:31 PM
Workbook startup condition wikegolfa Excel Discussion (Misc queries) 3 December 16th 04 03:11 PM
Stubborn toolbars in Excel 007 Excel Discussion (Misc queries) 9 December 11th 04 02:02 PM
Updating sheets within a workbook Mike R Excel Discussion (Misc queries) 1 December 4th 04 05:25 AM
copy\paste from one workbook to another Mark Excel Discussion (Misc queries) 0 November 25th 04 10:55 PM


All times are GMT +1. The time now is 10:01 PM.

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

About Us

"It's about Microsoft Excel"