Descricao: |
Essa macro do Aplicativo Microsoft Excel VBA, contém códigos que habilitam ou desabilitam todas as teclas de comando. observem que os simbolos representam uma tecla ( "^" = Ctrl ); ("%" = Alt ) ( "+" = Shift )
Sub desabilitando_teclas_insere_data_hora_e_salvar() Application.OnKey ";", "" Application.OnKey "S", "" End Sub
Sub Desabilitando_teclas() ' *** File *** Application.OnKey "^N", "" 'Ctrl+N novo arquivo Application.OnKey "^O", "" 'Ctrl+O abrir arquivo Application.OnKey "^S", "" 'Ctrl+S salvar Application.OnKey "{F12}", "" 'F12 salvar como Application.OnKey "%{F4}", "" 'Alt+F4 sair do Excel '*** Edit *** Application.OnKey "^H", "" 'Ctrl+H replace Application.OnKey "{F5}", "" 'F5 Goto '*** Insert *** Application.OnKey "^+{+}", "" 'Ctrl+Shift+ + inserir dialog box Application.OnKey "+{F11}", "" 'Shift+F11 novo worksheet Application.OnKey "{F11}", "" 'F11 novo gráfico Application.OnKey "^{F11}", "" 'Ctrl+F11 macro do Excel 4.0 Application.OnKey "+{F3}", "" 'Ctrl+F3 definir nome Application.OnKey "{F3}", "" 'F3 colar nomes Application.OnKey "^+{F3}", "" 'Ctrl+Shift+F3 criar nomes '*** Format *** Application.OnKey "^1", "" 'Ctrl+1 formatar células Application.OnKey "^9", "" 'Ctrl+9 esconder linhas Application.OnKey "^+{(}", "" 'Ctrl+Shift+( mostrar linhas Application.OnKey "^0", "" 'Ctrl+0 esconder colunas Application.OnKey "^+{)}", "" 'Ctrl+Shift+) mostrar colunas '*** Data *** Application.OnKey "%+{RIGHT}", "" 'Alt+Shift+RightArrow agrupa linhas/colunas Application.OnKey "%+{LEFT}", "" 'Alt+Shift+LeftArrow desagrupa linhas/colunas '*** Window *** Application.OnKey "{F6}", "" 'F6 próximo painel Application.OnKey "+{F6}", "" 'Shift+F6 painel anterior Application.OnKey "^{F6}", "" 'Ctrl+F6 próxima janela Application.OnKey "^+{F6}", "" 'Ctrl+Shift+F6 janela anterior '*** Outros *** Application.OnKey "^{PGUP}", "" 'Ctrl+PgUp sheet anterior Application.OnKey "^{PGDN}", "" 'Ctrl+PgDn sheet posterior Application.OnKey "+{F12}", "" 'Shift+F12 salvar Application.OnKey "^{F12}", "" 'Ctrl+F12 abrir Application.OnKey "^{TAB}", "" 'Ctrl+Tab próxima janela Application.OnKey "^+{TAB}", "" 'Ctrl+Shift+Tab janela anterior Application.OnKey "^{-}", "" 'Ctrl+- exclui seleção Application.OnKey "^{;}", "" 'Ctrl+; insere data Application.OnKey "^{:}", "" 'Ctrl+: insere hora Application.OnKey "{TAB}", "" 'Tab End Sub
Sub Habilitando_teclas() ' *** File *** Application.OnKey "^N" 'Ctrl+N novo arquivo Application.OnKey "^O" 'Ctrl+O abrir arquivo Application.OnKey "^S" 'Ctrl+S salvar Application.OnKey "{F12}" 'F12 salvar como Application.OnKey "%{F4}" 'Alt+F4 sair do Excel ' *** Edit *** Application.OnKey "^H" 'Ctrl+H replace Application.OnKey "{F5}" 'F5 Goto ' *** Insert *** Application.OnKey "^+{+}" 'Ctrl+Shift+ + inserir dialog box Application.OnKey "+{F11}" 'Shift+F11 novo worksheet Application.OnKey "{F11}" 'F11 novo gráfico Application.OnKey "^{F11}" 'Ctrl+F11 macro do Excel 4.0 Application.OnKey "+{F3}" 'Ctrl+F3 definir nome Application.OnKey "{F3}" 'F3 colar nomes Application.OnKey "^+{F3}" 'Ctrl+Shift+F3 criar nomes ' *** Format *** Application.OnKey "^1" 'Ctrl+1 formatar células Application.OnKey "^9" 'Ctrl+9 esconder linhas Application.OnKey "^+{(}" 'Ctrl+Shift+( mostrar linhas Application.OnKey "^0" 'Ctrl+0 esconder colunas Application.OnKey "^+{)}" 'Ctrl+Shift+) mostrar colunas ' *** Data *** Application.OnKey "%+{RIGHT}" 'Alt+Shift+RightArrow agrupa linhas/colunas Application.OnKey "%+{LEFT}" 'Alt+Shift+LeftArrow desagrupa linhas/colunas ' *** Window *** Application.OnKey "{F6}" 'F6 próximo painel Application.OnKey "+{F6}" 'Shift+F6 painel anterior Application.OnKey "^{F6}" 'Ctrl+F6 próxima janela Application.OnKey "^+{F6}" 'Ctrl+Shift+F6 janela anterior ' *** Outros *** Application.OnKey "^{PGUP}" 'Ctrl+PgUp sheet anterior Application.OnKey "^{PGDN}" 'Ctrl+PgDn sheet posterior Application.OnKey "+{F12}" 'Shift+F12 salvar Application.OnKey "^{F12}" 'Ctrl+F12 abrir Application.OnKey "^{TAB}" 'Ctrl+Tab próxima janela Application.OnKey "^+{TAB}" 'Ctrl+Shift+Tab janela anterior Application.OnKey "{TAB}" 'Tab Application.OnKey "^{-}" 'Ctrl+- exclui seleção Application.OnKey "^{;}" 'Ctrl+; insere data Application.OnKey "^{:}" 'Ctrl+: insere hora End Sub
Aprenda Aplicativo Microsoft Excel VBA - com SaberExcel VBA
|