View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Kai Smith[_2_] Kai Smith[_2_] is offline
external usenet poster
 
Posts: 6
Default XL97 - Log use of paste function in workbook

Sorry, forgot to include the code I already have...



Private Sub Workbook_Activate()

Application.OnKey "^v", "enterinlog"

Application.OnKey "+{INSERT}", "enterinlog"

Application.CellDragAndDrop = False

Application.OnDoubleClick = "Dummy"

End Sub



Private Sub Workbook_Deactivate()

Application.OnKey "^v"

Application.OnKey "+{INSERT}"

Application.CellDragAndDrop = True

Application.OnDoubleClick = ""

End Sub



Sub enterinlog()

Sheets("Log").Select

Rows("1:1").Select

Selection.Insert Shift:=xlDown

Range("A1").Select

ActiveCell.FormulaR1C1 = Application.UserName

Range("B1").Select

ActiveCell.FormulaR1C1 = DateTime.Now

Range("C1").Select

ActiveCell.FormulaR1C1 = "PASTE FUNCTION USED"

Sheets("Sheet1").Select

End Sub



Whenever I hit Ctrl+V, an error comes up saying "The macro '1' cannot be
found.". It doesn't log the paste function and where is it getting
macro 1 from???



Thanks





"Kai Smith" wrote in message
. uk:



Hi there




I'm a self taught VBA user, but I have a problem I just can't get over.




Basically I have a workbook (obviously) but I don't want people to paste


into it. I only want them to enter data manually. Is there any way to


do two things:




a) LOG all uses of a paste function into the spreadsheet onto a separate


sheet?


b) Disable the paste function altogether.




I want to disable the function in due course, but as people have been


asked several times not to paste into the spreadsheet, I want to know


who the culprit is.




Any help would be greatly appreciated.




Thanks








Kai