PDA

View Full Version : enable copy and paste



lior03
12-10-2006, 02:35 AM
hello
i recently noticed that when ever i copy a range and try to paste it through the right click shortcut the paste action can not be applied.
was it my doing?.can i restore the paste property?
thanks

davemcochran
12-10-2006, 08:15 AM
What kind of worksheet events do you have?

lucas
12-10-2006, 08:56 AM
Is it just one workbook or does it occur in all workbooks, even new?

lior03
12-10-2006, 09:48 AM
hello
it happens on a single workbook full of vba code lines. is there a way to return to the default copy -pastespecial mode?
thanks

lucas
12-10-2006, 10:23 AM
Can't tell from here.....is it just on one worksheet or all....post it because something caused it and we're guessing.

If you can't post the workbook then post the code from the thisworkbook module and the code from each sheet's code pane.

lucas
12-10-2006, 10:24 AM
It won't do any good to reset it if your code is just going to disable it again.....

lucas
12-10-2006, 10:30 AM
also if the workbook is protected then those right click items are disabled
tools protection protect workbook if it says unprotect workbook then ......
I might be wrong on this but as I said.....just guessing with the info I have

lior03
12-10-2006, 11:10 AM
hello
this is my code in thisworkbook sheet

Private Sub Workbook_BeforeClose(cancel As Boolean)
On Error GoTo errhandler
Application.StatusBar = ""
ResetShortcut
ResetShortcut1
ResetShortcut3
ResetShortcut4
ResetShortcut5
deletemenuitem
ActiveWorkbook.Save
DeleteCustomToolbars
Exit Sub
errhandler:
MsgBox "an error occured,please check your code", vbCritical
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, cancel As Boolean)
CreateMenu2
Application.Calculation = xlManual
Application.CalculateBeforeSave = True
Application.ScreenUpdating = False
Application.StatusBar = False
Application.StatusBar = " attention !!! " & ActiveWorkbook.name & " last save was at " & ActiveWorkbook.BuiltinDocumentProperties("last save time")
Application.Wait now + TimeValue("00:00:10")
Application.StatusBar = ActiveWorkbook.FullName
Application.Wait now + TimeValue("00:00:10")
Application.StatusBar = "please save regularly............"
Application.Wait now + TimeValue("00:00:10")
Application.StatusBar = False
Application.ScreenUpdating = True
End Sub
Private Sub Workbook_Deactivate()
If ActiveSheet.AutoFilterMode = True Then
ActiveSheet.AutoFilterMode = False
End If
End Sub
Private Sub Workbook_Open()
MsgBox " the workbook was born at " & ActiveWorkbook.BuiltinDocumentProperties("creation date")
addmenuitem
addshortcut
createtoolbars
clearstatusbar
AddItemToShortcut
additemtoshortcut1
additemtoshortcut2
AddItemToShortcut4
AddItemToShortcut5
AddItemToShortcut6
AddItemToShortcut7
CreateShortcut
excalibare11
commention
End Sub
Private Sub Workbook_BeforePrint(cancel As Boolean)
Dim userResponse
'turn off EnableEvents so this event is not triggered again by the printout
'statement below
Application.EnableEvents = False
'set Cancel to True to cancel the printout request from the user
cancel = True
'get a description from the user for the footer
userResponse = Application.InputBox(prompt:="Enter a description for the footer:", Default:=ActiveSheet.pagesetup.LeftFooter, _
Type:=2)
'if cancel is selected, bypass printing the sheet and changing the footer
If userResponse <> False Then
ActiveSheet.pagesetup.LeftFooter = userResponse
ActiveSheet.PrintPreview
End If
'turn event handling back on
Application.EnableEvents = True
End Sub
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, cancel As Boolean)
On Error Resume Next
calculate
If Target.Count > 1 Then Exit Sub
If Target.style = "Normal" Then
Target.style = "Jon"
Else: Target.style = "Normal"
End If
cancel = True
End Sub
Private Sub Workbook_NewSheet(ByVal Sh As Object)
Sh.Move After:=Sheets(Sheets.Count)
End Sub
Sub SumLastTwo()
Range("a65536").End(xlUp).Offset(0, 1).FormulaR1C1 = "=SUM(R[-1]C[-1],RC[-1])"
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Excel.Range)
calculate
Application.StatusBar = Sh.name & ":" & Target.Address
On Error Resume Next
Application.CommandBars("Cell").Controls("turn formula red").Delete
Application.CommandBars("Cell").Controls("resize comment").Delete
Application.CommandBars("Cell").Controls("show formula as comment").Delete
On Error GoTo 0
Dim NewItem As CommandBarControl
If IsEmpty(ActiveCell) Then Exit Sub
If Target.HasFormula = True Then
Set NewItem = Application.CommandBars("Cell").Controls.Add(Type:=msoControlButton, Temporary:=True)
With NewItem
.Caption = "show formula as comment"
.OnAction = "commentalony"
.BeginGroup = True
.style = msoButtonIconAndCaption
.FaceId = 391
End With
End If
On Error GoTo 0
If IsEmpty(ActiveCell) Then Exit Sub
If Target.HasFormula = True Then
Set NewItem = Application.CommandBars("Cell").Controls.Add(Type:=msoControlButton, Temporary:=True)
With NewItem
.Caption = "turn formula red"
.OnAction = "marco"
.BeginGroup = True
.style = msoButtonIconAndCaption
.FaceId = 353
End With
End If
On Error Resume Next
Dim c As comment
Set c = ActiveCell.comment
If Not c Is Nothing Then
Set NewItem = Application.CommandBars("Cell").Controls.Add(Type:=msoControlButton, Temporary:=True)
NewItem.Caption = "resize comment"
NewItem.OnAction = "autofitcomments"
NewItem.FaceId = 687
NewItem.BeginGroup = True
End If
calculate
End Sub

what will you say to that?
thanks

lucas
12-10-2006, 11:30 AM
hello
it happens on a single workbook full of vba code lines. is there a way to return to the default copy -pastespecial mode?
thanks
Hello lior03,
does it happen on every sheet in this specific workbook?

lior03
12-10-2006, 11:53 AM
hello
yes it does.it happen on every worksheet.
thanks

lucas
12-10-2006, 12:33 PM
If you right click on a worksheet tab and click on view code....is there any? If so post it please.