View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mark Thorpe Mark Thorpe is offline
external usenet poster
 
Posts: 11
Default VBA Code Interferring with User's Copy Action

Does this code need to be executed every time the workbook is activated? Or
could you get away with moving the code to Workbook_Open?

Another possibility to look into is checking the value of
Application.CutCopyMode in your Activate function. This will at least tell
you whether something has been copied to the clipboard from Excel. For
example:

Private Sub Workbook_Activate()
If Application.CutCopyMode < False Then
application.displayformulabar = false
End If
End Sub

"spacecityguy " wrote in
message ...
Hi,

I've inherited an Excel template that applies application methods (such
as hiding a custom menu) when the workbook is activated. I received
quite a few user complaints on not able to copy into the template from
another workbook. I stepped through the code and realized that that
every time after the user switches back to the template, the
application methods are executed, and then the ability to paste using
Edit/Paste or Paste Special is lost. It seems this is the case
everytime a menu command is executed. I know the user can paste it from
the clipboard, but it's an inconvenience that she has to pick out the
item to paste and the paste operation changes the format of the target
cells. I wonder if anybody knows how to get around this problem. To
see this problem, open two workbooks. In the first work book, put in
something like this:

Private Sub Workbook_Activate()
application.displayformulabar = false
End Sub

Copy something using Ctrl-C in the second workbook, switch back to the
first and then try to paste. It doesn't work, although you can find the
contents still in the clipboard.

Thanks for any insight.

spacecityguy


---
Message posted from http://www.ExcelForum.com/