Office中国论坛/Access中国论坛

标题: [求助]怎样实现excel工作表只能看不能复制 [打印本页]

作者: zyhxiaoma    时间: 2008-11-5 10:02
标题: [求助]怎样实现excel工作表只能看不能复制
怎样实现excel工作表只能看不能复制,复制到其他表也不行。
作者: pureshadow    时间: 2008-11-5 11:17
保护的方式可以使表内的公式无法复制到其他表。
如果要完全不能复制,可以用代码禁用复制功能,不过这样一来很麻烦,因为复制功能不是EXCEL一个在用。
作者: 方漠    时间: 2008-11-6 21:42
转成PDF, 转换时选不可复制. 或者打印成图片.

Try below code:

'Disable Cut/Copy in Excel Workbooks

'The code below must be placed in the Private Module of the Workbook Object (ThisWorkbook).
'To get there easily, right click on the Excel icon, top left next to File and choose View Code.
'In here paste the code below, close & save and then re-open.

Private Sub Workbook_Activate()
Dim oCtrl As Office.CommandBarControl

'Disable all Cut menus
     For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
            oCtrl.Enabled = False
     Next oCtrl
   
'Disable all Copy menus
     For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
            oCtrl.Enabled = False
     Next oCtrl
      
        Application.CellDragAndDrop = False

End Sub

Private Sub Workbook_Deactivate()
Dim oCtrl As Office.CommandBarControl

'Enable all Cut menus
     For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
            oCtrl.Enabled = True
     Next oCtrl
   
'Enable all Copy menus
     For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
            oCtrl.Enabled = True
     Next oCtrl
      
        Application.CellDragAndDrop = True

End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    With Application
        .CellDragAndDrop = False
        .CutCopyMode = False      'Clear clipboard
    End With
End Sub
作者: pureshadow    时间: 2008-11-6 23:33
方大侠今天刚上任就抖出好料啊,收藏了,谢谢。




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3