Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Workbook_Activate question

Good afternoon, all!

If, via VBA, I open a workbook that contains a workbook_activate macro, will
it run when the workbook opens (and by default activates), or only if I
reference it call it specifically from within my calling macro?

Thanks in advance

Pete


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Workbook_Activate question

Pete,

Yes, the Activate event will run, after the Open event runs.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Peter Rooney" wrote in
message
...
Good afternoon, all!

If, via VBA, I open a workbook that contains a
workbook_activate macro, will
it run when the workbook opens (and by default activates), or
only if I
reference it call it specifically from within my calling macro?

Thanks in advance

Pete




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Workbook_Activate question

Chip,

Oh dear. Just for your info, I have a template workbook which is used to
create other workbooks using Save As. I then produce consolidations using VAB
by opening these new workbooks and copying and pasting to the master
workbook. Each workbook has Workbook_Open, Workbook_BeforeClose, Activate and
deactivate macros.

The only problem is, something in my deactivate macro is clearing the
Windows clipboard, which means that when I activate the target worksheet,
there's nothing to paste. I've isolated which sub macro reference in my
deactivate macro causes this to happen, but I don't know if it empties the
clipboard when its called by the deactivate in the consolidating workbook, or
by the deactivate in the workbook that is being consolidated. As I use save
As, each copy of the workbook is saved with an identical structure, macro
sheets etc.

So now at least I know that my problem could be being caused in two places,
as against one!

Just what I need on a Friday afternoon :-)

If you have any thoughts on things that empty the clipboard without you
knowing it, I'd be delighted to know about them!

In the meantime, if you don't reply before 16:30 (about 15 minutes away),
have a good weekend!

Regards

Pete



"Chip Pearson" wrote:

Pete,

Yes, the Activate event will run, after the Open event runs.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Peter Rooney" wrote in
message
...
Good afternoon, all!

If, via VBA, I open a workbook that contains a
workbook_activate macro, will
it run when the workbook opens (and by default activates), or
only if I
reference it call it specifically from within my calling macro?

Thanks in advance

Pete





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Workbook_Activate question

Use
Application.EnableEvents = False
' do your copy and paste
Application.EnableEvents = True

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in message
...
Chip,

Oh dear. Just for your info, I have a template workbook which is used to
create other workbooks using Save As. I then produce consolidations using

VAB
by opening these new workbooks and copying and pasting to the master
workbook. Each workbook has Workbook_Open, Workbook_BeforeClose, Activate

and
deactivate macros.

The only problem is, something in my deactivate macro is clearing the
Windows clipboard, which means that when I activate the target worksheet,
there's nothing to paste. I've isolated which sub macro reference in my
deactivate macro causes this to happen, but I don't know if it empties the
clipboard when its called by the deactivate in the consolidating workbook,

or
by the deactivate in the workbook that is being consolidated. As I use

save
As, each copy of the workbook is saved with an identical structure, macro
sheets etc.

So now at least I know that my problem could be being caused in two

places,
as against one!

Just what I need on a Friday afternoon :-)

If you have any thoughts on things that empty the clipboard without you
knowing it, I'd be delighted to know about them!

In the meantime, if you don't reply before 16:30 (about 15 minutes away),
have a good weekend!

Regards

Pete



"Chip Pearson" wrote:

Pete,

Yes, the Activate event will run, after the Open event runs.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Peter Rooney" wrote in
message
...
Good afternoon, all!

If, via VBA, I open a workbook that contains a
workbook_activate macro, will
it run when the workbook opens (and by default activates), or
only if I
reference it call it specifically from within my calling macro?

Thanks in advance

Pete







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Workbook_Activate question

Tom!

You're an absolute GENIUS!

This is EXACTLY what I wanted.

By disabling the Workbook_Deactivate event, the ScreenReset macro doesn't
kick in, which doesn't change the display options, which doesn't empty the
Clipboard!

You've solved ALL my problems from all the posts I've left recently.

I'd seen enableevents, but I didn't really understand what it did.

If I could give you ten green ticks, I would! :-)

Sorry to go over the top, but this has helped me out of an enormous hole.

Thanks very much!

Pete





"Tom Ogilvy" wrote:

Use
Application.EnableEvents = False
' do your copy and paste
Application.EnableEvents = True

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in message
...
Chip,

Oh dear. Just for your info, I have a template workbook which is used to
create other workbooks using Save As. I then produce consolidations using

VAB
by opening these new workbooks and copying and pasting to the master
workbook. Each workbook has Workbook_Open, Workbook_BeforeClose, Activate

and
deactivate macros.

The only problem is, something in my deactivate macro is clearing the
Windows clipboard, which means that when I activate the target worksheet,
there's nothing to paste. I've isolated which sub macro reference in my
deactivate macro causes this to happen, but I don't know if it empties the
clipboard when its called by the deactivate in the consolidating workbook,

or
by the deactivate in the workbook that is being consolidated. As I use

save
As, each copy of the workbook is saved with an identical structure, macro
sheets etc.

So now at least I know that my problem could be being caused in two

places,
as against one!

Just what I need on a Friday afternoon :-)

If you have any thoughts on things that empty the clipboard without you
knowing it, I'd be delighted to know about them!

In the meantime, if you don't reply before 16:30 (about 15 minutes away),
have a good weekend!

Regards

Pete



"Chip Pearson" wrote:

Pete,

Yes, the Activate event will run, after the Open event runs.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Peter Rooney" wrote in
message
...
Good afternoon, all!

If, via VBA, I open a workbook that contains a
workbook_activate macro, will
it run when the workbook opens (and by default activates), or
only if I
reference it call it specifically from within my calling macro?

Thanks in advance

Pete










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
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good davegb Excel Programming 1 May 6th 05 06:35 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 27th 05 07:46 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 23 April 23rd 05 09:26 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 22nd 05 03:30 PM


All times are GMT +1. The time now is 05:46 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"