<p>Durch VBA das Ausschneiden, Kopieren und Einfügen verhindern.</p>
<p>Bis Excel 2003 sind die Schaltflächen dann deaktiviert (gegraut).<br /> Ab Excel 2007 sind die Schaltflächen auf dem Ribbon immer noch<br /> optisch aktiv aber sie sind ohne Funktion. Besser ist es das Ribbon selbst mit XML anzupassen.</p>
<p> </p>
<div style="background: #ffffff; overflow: auto; width: auto; border: solid gray; border-width: .1em .1em .1em .8em; padding: .2em .6em;">
<pre style="margin: 0; line-height: 125%;"><span style="color: #000080; font-weight: bold;">Sub</span> EnableControl(Id <span style="font-weight: bold;">As</span> <span style="color: #000080; font-weight: bold;">Integer</span>, Enabled <span style="font-weight: bold;">As</span> <span style="color: #000080; font-weight: bold;">Boolean</span>)
<span style="color: #000080; font-weight: bold;">Dim</span> CB <span style="font-weight: bold;">As</span> CommandBar
<span style="color: #000080; font-weight: bold;">Dim</span> C <span style="font-weight: bold;">As</span> CommandBarControl
<span style="color: #000080; font-weight: bold;">For</span> <span style="color: #000080; font-weight: bold;">Each</span> CB <span style="font-weight: bold;">In</span> Application.CommandBars
<span style="color: #000080; font-weight: bold;">Set</span> C = CB.FindControl(Id:=Id, recursive:=<span style="color: #000080; font-weight: bold;">True</span>)
<span style="color: #000080; font-weight: bold;">If</span> <span style="color: #000080; font-weight: bold;">Not</span> C <span style="font-weight: bold;">Is</span> <span style="color: #000080; font-weight: bold;">Nothing</span> <span style="color: #000080; font-weight: bold;">Then</span> C.Enabled = Enabled
<span style="color: #000080; font-weight: bold;">Next</span>
<span style="color: #000080; font-weight: bold;">End</span> <span style="color: #000080; font-weight: bold;">Sub</span>
<span style="color: #000080; font-weight: bold;">Private</span> <span style="color: #000080; font-weight: bold;">Sub</span> Workbook_Activate()
<span style="color: #008800; font-style: italic;">' Die Befehlsschaltflächen deaktivieren</span>
EnableControl <span style="color: #0000ff;">21</span>, <span style="color: #000080; font-weight: bold;">False</span> <span style="color: #008800; font-style: italic;">' Ausschneiden (cut)</span>
EnableControl <span style="color: #0000ff;">19</span>, <span style="color: #000080; font-weight: bold;">False</span> <span style="color: #008800; font-style: italic;">' Kopieren (copy)</span>
EnableControl <span style="color: #0000ff;">22</span>, <span style="color: #000080; font-weight: bold;">False</span> <span style="color: #008800; font-style: italic;">' Einfügen (paste)</span>
EnableControl <span style="color: #0000ff;">755</span>, <span style="color: #000080; font-weight: bold;">False</span> <span style="color: #008800; font-style: italic;">' Inhalte Einfügen (pastespecial)</span>
<span style="color: #008800; font-style: italic;">' Tastenkombinationen abfangen</span>
Application.OnKey <span style="color: #0000ff;">"^c"</span>, <span style="color: #0000ff;">""</span> <span style="color: #008800; font-style: italic;">' STRG + c kopieren abfangen (copy)</span>
Application.OnKey <span style="color: #0000ff;">"^v"</span>, <span style="color: #0000ff;">""</span> <span style="color: #008800; font-style: italic;">' STRG + v einfügen abfangen (cut)</span>
Application.OnKey <span style="color: #0000ff;">"^x"</span>, <span style="color: #0000ff;">""</span> <span style="color: #008800; font-style: italic;">' STRG + x ausschneiden abfangen (cut)</span>
Application.OnKey <span style="color: #0000ff;">"+{DEL}"</span>, <span style="color: #0000ff;">""</span> <span style="color: #008800; font-style: italic;">' SHIFT + ENTF auschneiden abfangen (cut)</span>
Application.OnKey <span style="color: #0000ff;">"+{INSERT}"</span>, <span style="color: #0000ff;">""</span> <span style="color: #008800; font-style: italic;">' SHIFT + EINFG einfügen abfangen (paste)</span>
<span style="color: #008800; font-style: italic;">' Zellen mit dem Randanfasser verschieben, kopieren verhindern</span>
Application.CellDragAndDrop = <span style="color: #000080; font-weight: bold;">False</span>
<span style="color: #000080; font-weight: bold;">End</span> <span style="color: #000080; font-weight: bold;">Sub</span>
<span style="color: #000080; font-weight: bold;">Private</span> <span style="color: #000080; font-weight: bold;">Sub</span> Workbook_Open()
<span style="color: #008800; font-style: italic;">' Die Befehlsschaltflächen deaktivieren</span>
EnableControl <span style="color: #0000ff;">21</span>, <span style="color: #000080; font-weight: bold;">False</span> <span style="color: #008800; font-style: italic;">' Ausschneiden (copy)</span>
EnableControl <span style="color: #0000ff;">19</span>, <span style="color: #000080; font-weight: bold;">False</span> <span style="color: #008800; font-style: italic;">' Kopieren (copy)</span>
EnableControl <span style="color: #0000ff;">22</span>, <span style="color: #000080; font-weight: bold;">False</span> <span style="color: #008800; font-style: italic;">' Einfügen (paste)</span>
EnableControl <span style="color: #0000ff;">755</span>, <span style="color: #000080; font-weight: bold;">False</span> <span style="color: #008800; font-style: italic;">' '</span>
<span style="color: #008800; font-style: italic;">' Tastenkombinationen abfangen</span>
Application.OnKey <span style="color: #0000ff;">"^c"</span>, <span style="color: #0000ff;">""</span> <span style="color: #008800; font-style: italic;">' STRG + c Kopieren (copy)</span>
Application.OnKey <span style="color: #0000ff;">"^v"</span>, <span style="color: #0000ff;">""</span> <span style="color: #008800; font-style: italic;">' STRG + v (cut)</span>
Application.OnKey <span style="color: #0000ff;">"^x"</span>, <span style="color: #0000ff;">""</span> <span style="color: #008800; font-style: italic;">' STRG + x (paste)</span>
Application.OnKey <span style="color: #0000ff;">"+{DEL}"</span>, <span style="color: #0000ff;">""</span> <span style="color: #008800; font-style: italic;">' SHIFT + ENTF (cut)</span>
Application.OnKey <span style="color: #0000ff;">"+{INSERT}"</span>, <span style="color: #0000ff;">""</span> <span style="color: #008800; font-style: italic;">' SHIFT + EINFG (paste)</span>
<span style="color: #008800; font-style: italic;">' Zellen mit dem Randanfasser verschieben, kopieren wieder ermöglichen</span>
Application.CellDragAndDrop = <span style="color: #000080; font-weight: bold;">False</span>
<span style="color: #000080; font-weight: bold;">End</span> <span style="color: #000080; font-weight: bold;">Sub</span>
<span style="color: #000080; font-weight: bold;">Private</span> <span style="color: #000080; font-weight: bold;">Sub</span> Workbook_BeforeClose(Cancel <span style="font-weight: bold;">As</span> <span style="color: #000080; font-weight: bold;">Boolean</span>)
<span style="color: #008800; font-style: italic;">' Die Befehlsschaltflächen wieder aktivieren</span>
EnableControl <span style="color: #0000ff;">21</span>, <span style="color: #000080; font-weight: bold;">True</span> <span style="color: #008800; font-style: italic;">' Ausschneiden (cut)</span>
EnableControl <span style="color: #0000ff;">19</span>, <span style="color: #000080; font-weight: bold;">True</span> <span style="color: #008800; font-style: italic;">' Kopieren (copy)</span>
EnableControl <span style="color: #0000ff;">22</span>, <span style="color: #000080; font-weight: bold;">True</span> <span style="color: #008800; font-style: italic;">' Einfügen (paste)</span>
EnableControl <span style="color: #0000ff;">755</span>, <span style="color: #000080; font-weight: bold;">True</span> <span style="color: #008800; font-style: italic;">' pastespecial</span>
<span style="color: #008800; font-style: italic;">' Tastenkombinationen abfangen</span>
Application.OnKey <span style="color: #0000ff;">"^c"</span> <span style="color: #008800; font-style: italic;">' STRG + c (copy)</span>
Application.OnKey <span style="color: #0000ff;">"^v"</span> <span style="color: #008800; font-style: italic;">' STRG + v (cut)</span>
Application.OnKey <span style="color: #0000ff;">"^x"</span> <span style="color: #008800; font-style: italic;">' STRG + x (cut)</span>
Application.OnKey <span style="color: #0000ff;">"+{DEL}"</span> <span style="color: #008800; font-style: italic;">' SHIFT + ENTF (cut)</span>
Application.OnKey <span style="color: #0000ff;">"+{INSERT}"</span> <span style="color: #008800; font-style: italic;">' SHIFT + EINFG (paste)</span>
<span style="color: #008800; font-style: italic;">' Zellen mit dem Randanfasser verschieben, kopieren wieder ermöglichen</span>
Application.CellDragAndDrop = <span style="color: #000080; font-weight: bold;">True</span>
<span style="color: #000080; font-weight: bold;">End</span> <span style="color: #000080; font-weight: bold;">Sub</span>
<span style="color: #000080; font-weight: bold;">Private</span> <span style="color: #000080; font-weight: bold;">Sub</span> Workbook_Deactivate()
<span style="color: #008800; font-style: italic;">' Die Befehlsschaltflächen wieder aktivieren</span>
EnableControl <span style="color: #0000ff;">21</span>, <span style="color: #000080; font-weight: bold;">True</span> <span style="color: #008800; font-style: italic;">' Kopieren (copy)</span>
EnableControl <span style="color: #0000ff;">19</span>, <span style="color: #000080; font-weight: bold;">True</span> <span style="color: #008800; font-style: italic;">' Kopieren (copy)</span>
EnableControl <span style="color: #0000ff;">22</span>, <span style="color: #000080; font-weight: bold;">True</span> <span style="color: #008800; font-style: italic;">' Einfügen (paste)</span>
EnableControl <span style="color: #0000ff;">755</span>, <span style="color: #000080; font-weight: bold;">True</span> <span style="color: #008800; font-style: italic;">' ' Inhalte Einfügen (pastespecial)</span>
<span style="color: #008800; font-style: italic;">' Tastenkombinationen wieder einschalten</span>
Application.OnKey <span style="color: #0000ff;">"^c"</span> <span style="color: #008800; font-style: italic;">' STRG + c Kopieren (copy)</span>
Application.OnKey <span style="color: #0000ff;">"^v"</span> <span style="color: #008800; font-style: italic;">' STRG + v Einfügen (paste)</span>
Application.OnKey <span style="color: #0000ff;">"^x"</span> <span style="color: #008800; font-style: italic;">' STRG + v ausschneiden (cut)</span>
Application.OnKey <span style="color: #0000ff;">"+{DEL}"</span> <span style="color: #008800; font-style: italic;">' SHIFT + ENTF (cut)</span>
Application.OnKey <span style="color: #0000ff;">"+{INSERT}"</span> <span style="color: #008800; font-style: italic;">' SHIFT + EINFG (paste)</span>
<span style="color: #008800; font-style: italic;">' Zellen mit dem Randanfasser verschieben, kopieren wieder ermöglichen</span>
Application.CellDragAndDrop = <span style="color: #000080; font-weight: bold;">True</span>
<span style="color: #000080; font-weight: bold;">End</span> <span style="color: #000080; font-weight: bold;">Sub</span>
</pre>
</div>
<div> </div>