ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

Worksheet_Deactivate() µ{§Ç±Ò°Ê¥¢±Ñ?? (¤w¸Ñ¨M)

Worksheet_Deactivate() µ{§Ç±Ò°Ê¥¢±Ñ?? (¤w¸Ñ¨M)

¥»©«³Ì«á¥Ñ riceeric ©ó 2012-3-16 09:34 ½s¿è

§Ú¦³­Ó¨ú®ø©ì©ÔÀx¦s®æªº¨Æ¥óCode¡A¦ý¬OWorksheet_Deactivate()³o­Óµ{§Ç¦b¦P¤@­ÓExcelÀɤÁ´«¨ì¥t¤@­Ó¤u§@ªí®É·|±Ò°Ê³o­Ó¨Æ¥ó
¦ý¬O±q³o­Ó¤u§@ªíÂI¶}¥t¤@­ÓExcelÀɳo­Ó¨Æ¥ó«o¤£·|³Q°õ¦æ
§ó©_©Çªº¬O§Ú´«³¡¹q¸£¹Á¸Õ³o­ÓÀɮסA¦³3¥x«o¥i¥H¡A¦³1¥x¸ò§Úªº¤@¼Ë¤£¦æ
¦³°ª¤â¥i¥HÀ°§Ú¸Ñ´b¶Ü?
---------------------------------------Code¬°§Ú¬°¤FÂê¦í©ì©ÔÀx¦s®æ¥H¤Î½Æ»s¥\¯à¼gªº
  1. '±Ò°Ê¦¹¤u§@ªí¨Æ¥ó
  2. Private Sub Worksheet_Activate()
  3. '¸T¤î©ì©ÔÀx¦s®æ
  4. Application.CellDragAndDrop = False
  5. Dim copyCtls As CommandBarControls
  6. Dim copyCtl As CommandBarControl
  7. Application.CutCopyMode = False
  8. '´M§ä©Ò¦³ [½Æ»s] «ö¶s, ¨äID¬°19
  9. Set copyCtls = Application.CommandBars.FindControls(ID:=19)
  10. '±N©Ò¦³ [½Æ»s] «ö¶s¥\¯à¨ú®ø
  11. For Each copyCtl In copyCtls
  12. copyCtl.Enabled = False
  13. Next
  14. '¨ú®ø [½Æ»s] §Ö±¶Áä
  15. Application.OnKey "^c", ""
  16. '¤u§@ªí¼ÐÅÒ¥kÁä©Ò¸õ¥X¨Óªº "ply" ¤u¨ã¦C"²¾°Ê©Î½Æ»s(M)..." «ö¶s¥i²¾°Ê¨Ã²£¥Í°Æ¥»
  17. '¦]¦¹¤@¦}¸T¤î
  18. Application.CommandBars("ply").Controls(5).Enabled = False
  19. '¥H¤WÀ³¸Ó´NµLªk½Æ»s¤F
  20. End Sub


  21. '²¾¥X¦¹¤u§@ªíµ{§Ç
  22. Private Sub Worksheet_Deactivate()
  23.     '¨t²Î«ì´_©ì©Ô¥\¯à
  24.     Application.CellDragAndDrop = True
  25.     Dim copyCtls As CommandBarControls
  26. Dim copyCtl As CommandBarControl
  27.     '´M§ä©Ò¦³ [½Æ»s] «ö¶s, ¨äID¬°19
  28.     Set copyCtls = Application.CommandBars.FindControls(ID:=19)
  29.     '±N©Ò¦³ [½Æ»s] «ö¶s¥\¯à«ì´_
  30.     For Each copyCtl In copyCtls
  31.         copyCtl.Enabled = True
  32.     Next
  33.     '«ì´_ [½Æ»s] §Ö±¶Áä
  34.     Application.OnKey "^c"
  35.     '«ì´_¤u§@ªí¼ÐÅÒ¥kÁä©Ò¸õ¥X¨Óªº "ply" ¤u¨ã¦C"²¾°Ê©Î½Æ»s(M)..." «ö¶s¥\¯à
  36.     Application.CommandBars("ply").Controls(5).Enabled = True
  37.     '¥H¤WÀ³¸Ó´N¥i¥H½Æ»s¤F
  38. End Sub
½Æ»s¥N½X
Eric.Tu

¦^´_ 1# riceeric
±q³o­Ó¤u§@ªíÂI¶}¥t¤@­ÓExcelÀɳo­Ó¨Æ¥ó«o¤£·|³Q°õ¦æ
¸Ó¬O¥Î  ThisWorkbooKªº Deactivate ¨Æ¥ó
  1. Private Sub Workbook_Deactivate()
  2.     Run "Sheet1.Worksheet_Deactivate"
  3. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# GBKEE


    ·P¿E¤£ºÉ¡A¥i¥H¥Î¤F¡ã:)
Eric.Tu

TOP

        ÀR«ä¦Û¦b : ¤ß¤¤±`¦sµ½¸Ñ¡B¥]®e¡B·P«ä¡Bª¾¨¬¡B±¤ºÖ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD