cjsmile2016
New Member
- Joined
- Jan 24, 2005
- Messages
- 14
My problem is when I attempt to make the Module VBA private I recieve an error in the workbook section for the EnableCopyCutAndPast or DisableCopyCutAndPaste saying that "Sub or Function not defined". Its works great if I leave the Module at Sub I only get the error when I use Private Sub. Any help would be great...Thank you!!
I'm using this code in my Module:
Sub DisableCopyCutAndPaste()
EnableControl 21, False ' cut
EnableControl 19, False ' copy
EnableControl 22, False ' paste
EnableControl 755, False ' pastespecial
EnableControl 848, False ' move/copy sheet
Application.OnKey "^c", "Dummy"
Application.OnKey "^v", "Dummy"
Application.OnKey "+{DEL}", "Dummy"
Application.OnKey "+{INSERT}", "Dummy"
Application.CellDragAndDrop = False
Application.OnDoubleClick = "Dummy"
CommandBars("ToolBar List").Enabled = False
End Sub
Sub EnableCopyCutAndPaste()
EnableControl 21, True ' cut
EnableControl 19, True ' copy
EnableControl 22, True ' paste
EnableControl 755, True ' pastespecial
EnableControl 848, True ' move/copy sheet
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "+{DEL}"
Application.OnKey "+{INSERT}"
Application.CellDragAndDrop = True
Application.OnDoubleClick = ""
CommandBars("ToolBar List").Enabled = True
End Sub
and using this in my workbook:
Private Sub Workbook_Open()
UnhideSheets
DisableCopyCutAndPaste
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
HideSheets
EnableCopyCutAndPaste
End Sub
Thanks again,
Tim
I'm using this code in my Module:
Sub DisableCopyCutAndPaste()
EnableControl 21, False ' cut
EnableControl 19, False ' copy
EnableControl 22, False ' paste
EnableControl 755, False ' pastespecial
EnableControl 848, False ' move/copy sheet
Application.OnKey "^c", "Dummy"
Application.OnKey "^v", "Dummy"
Application.OnKey "+{DEL}", "Dummy"
Application.OnKey "+{INSERT}", "Dummy"
Application.CellDragAndDrop = False
Application.OnDoubleClick = "Dummy"
CommandBars("ToolBar List").Enabled = False
End Sub
Sub EnableCopyCutAndPaste()
EnableControl 21, True ' cut
EnableControl 19, True ' copy
EnableControl 22, True ' paste
EnableControl 755, True ' pastespecial
EnableControl 848, True ' move/copy sheet
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "+{DEL}"
Application.OnKey "+{INSERT}"
Application.CellDragAndDrop = True
Application.OnDoubleClick = ""
CommandBars("ToolBar List").Enabled = True
End Sub
and using this in my workbook:
Private Sub Workbook_Open()
UnhideSheets
DisableCopyCutAndPaste
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
HideSheets
EnableCopyCutAndPaste
End Sub
Thanks again,
Tim