Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Pasting after Workbook Activate event

I have some VBA code that makes a menu item on the standard menu bar
appear/disappear based on whether a certain workbook (MyWorkbook) is
the active workbook. Some of this code is located in the ThisWorkbook
object which then calls other procedures located in Module1. For those
of you that may be familiar, I'm using the code crated by Byg Software.

My question is this. If I am trying to copy/paste something to/from
MyWorkbook, the Workbook Activate event clears the clipboard which
pretty much (well, completely) kills the procedure.

Is there any way around this?

Thanks,
Mike.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default Pasting after Workbook Activate event

set some variable to the range you want to copy, like
Set MyVariable = Range("RangeToCopy")
then IN the workbook.Activate, before pasting, copy (again, maybe) by
MyVariable.Copy
THEN paste.

Bob Umlas
Excel MVP

"Michael Malinsky" wrote in message
ups.com...
I have some VBA code that makes a menu item on the standard menu bar
appear/disappear based on whether a certain workbook (MyWorkbook) is
the active workbook. Some of this code is located in the ThisWorkbook
object which then calls other procedures located in Module1. For those
of you that may be familiar, I'm using the code crated by Byg Software.

My question is this. If I am trying to copy/paste something to/from
MyWorkbook, the Workbook Activate event clears the clipboard which
pretty much (well, completely) kills the procedure.

Is there any way around this?

Thanks,
Mike.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Pasting after Workbook Activate event

You need to temporarily disable the events to keep the events from firing,
something like this (an error handler is advised with this type of code)...

sub YourSub()
on error goto ErrorHandler
application.enableevents = false
'your code here (no events will be firing)

ErrorHandler:
application.enableevents = true 'events are back on
end sub
--
HTH...

Jim Thomlinson


"Michael Malinsky" wrote:

I have some VBA code that makes a menu item on the standard menu bar
appear/disappear based on whether a certain workbook (MyWorkbook) is
the active workbook. Some of this code is located in the ThisWorkbook
object which then calls other procedures located in Module1. For those
of you that may be familiar, I'm using the code crated by Byg Software.

My question is this. If I am trying to copy/paste something to/from
MyWorkbook, the Workbook Activate event clears the clipboard which
pretty much (well, completely) kills the procedure.

Is there any way around this?

Thanks,
Mike.


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
Worksheet Activate Event Jason Excel Programming 1 October 29th 04 10:39 PM
Activate / Deactivate mouse move event Rolo[_3_] Excel Programming 2 January 29th 04 01:50 PM
Userform activate event question dan Excel Programming 1 January 26th 04 04:14 PM
Activate sheet event Mike Fogleman Excel Programming 5 January 18th 04 11:02 PM
Activate event Lynn[_3_] Excel Programming 2 September 13th 03 09:30 PM


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