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

public Åܶqªº­È¥i¥Hºû«ù¦h¤[?

public Åܶqªº­È¥i¥Hºû«ù¦h¤[?

¼Ð·Ç¼Ò²Õ«Å§ipublic X,¼Ð·Ç¼Ò²Õ¤@­Ó¥¨¶°"Macro1"¨½µ¹X½á­ÈX=123.
´N¬O¤£ª¾¹D,x=123³o­Ó­È,ºû«ù¨ì¤°»ò®É­Ô©O?
lmh

¼Ð·Ç¼Ò²Õ«Å§ipublic X,¼Ð·Ç¼Ò²Õ¤@­Ó¥¨¶°"Macro1"¨½µ¹X½á­ÈX=123.
´N¬O¤£ª¾¹D,x=123³o­Ó­È,ºû«ù¨ì¤°»ò®É­Ô©O ...
mhl9mhl9 µoªí©ó 2018-8-17 21:25

§Ú¬°¤°»ò·|µo°Ý³o­Ó©_©Çªº°ÝÃD?¤½¥ÎÅܼÆ"public X"©M§½³¡ÅܼÆ"static X",¥u­n¤£Ãö³¬³o­Ó¤å¥ó,X·|©l²×«O«ù¥¦ªº­È.
¦ý§Ú´ú¸Õ¦h¦¸°¸µM,X="",´ú¸Õµ²ªG¬O:¤u§@悔¥ô¦óµ{§Ç¥X¿ù,§A¿ï¾Ü"°h¥Xµ{§Ç",¾É­PX="".
¦³°Ý¦U¦ì¤j¤j,§Úªº²z¸Ñ¹ï¤£¹ï?
lmh

TOP

¥ô¦óIJ¨Ï VBA Code ­«·s³Q½sĶªº°Ê§@ , x ­È´N·|®ø¥¢

©Î Àɮ׳QÃö³¬

TOP

¦^´_ 2# mhl9mhl9
yes

TOP

¼Ð·Ç¼Ò²Õ«Å§ipublic X,¼Ð·Ç¼Ò²Õ¤@­Ó¥¨¶°"Macro1"¨½µ¹X½á­ÈX=123.
´N¬O¤£ª¾¹D,x=123³o­Ó­È,ºû«ù¨ì¤°»ò®É­Ô©O ...
mhl9mhl9 µoªí©ó 2018-8-17 21:25

§Ú¬°¤°»ò·|µo°Ý³o­Ó©_©Çªº°ÝÃD?¤½¥ÎÅܼÆ"public X"©M§½³¡ÅܼÆ"static X",¥u­n¤£Ãö³¬³o­Ó¤å¥ó,X·|©l²×«O«ù¥¦ªº­È.
¦ý§Ú´ú¸Õ¦h¦¸°¸µM,X="",´ú¸Õµ²ªG¬O:¤u§@悔¥ô¦óµ{§Ç¥X¿ù,§A¿ï¾Ü"°h¥Xµ{§Ç",¾É­PX="".
¦³°Ý¦U¦ì¤j¤j,§Úªº²z¸Ñ¹ï¤£¹ï?
°µ¤å¥ó,±`±`·|»Ý­n¬Y­ÓÅܶqºû«ù¤@­Ó©T©wªº­È,¦p public X,¤S¦pstatic X,¤S¦pproperty get X,¤@¥¹X³Q½á­È,¤å¥ó¤£Ãö³¬,X­È©l²×·|«O«ù.
¦ý¦³¨Ò¥~,´N¬O¤å¥ó¨½¥ô¦óµ{¦¡¥X¿ù,§A¤S¨S¦³³B²z"°£¿ù",µ²ªG¤W­zÅܶqX´NÅܦ¨"ªÅ­È",¾É­P»Ý­nX­Èªºµ{§Ç³£³ø¿ù!
§Ú²{¦b·Q¨ìªº¸Ñ¨M¤èªk(1)¥Îon error goto linex,Åýµ{¦¡¸õ¹L¿ù»~´Nend sub,³o¼Ë°µX­È·|«O«ù(2)¦bon error goto linex«á­±­«·sµ¹X½á­È.
¦³°Ý¦U¦ì¤j¤j,§Úªº²z¸Ñ¹ï¤£¹ï?
¤å¥ó°µ¤F¤£¤Ö,¤W­z±¡ªp¤µ¤Ñ¤~µoı,Ãø©Ç¤å¥ó²ö¦W¨ä§®³ø¿ù,­ì¨Ó­ì¦]¤§¤@´N¦b³o¨à.
lmh

TOP

¦^´_ 5# mhl9mhl9

´ú¸Õ¦h¦¸°¸µM,X="",´ú¸Õµ²ªG¬O:¤u§@悔¥ô¦óµ{§Ç¥X¿ù,§A¿ï¾Ü"°h¥Xµ{§Ç",¾É­PX="".

   ªþ¤WÀɮ׬ݬݵ{¦¡½X.
¥i¸Õ¸Õ©w¸q¦WºÙ,ÀÉ®×Ãö³¬«á«ü©wªº­ÈÁÙ¬O¦s¦b.
  1. Option Explicit
  2. Private Sub Workbook_Open()
  3.     Dim N, Msg As Boolean
  4.     For Each N In Names
  5.         If N.Name = "Gbkee" Then Msg = True: Exit For
  6.     Next
  7.     If Msg = False Then Names.Add "Gbkee", Date, False
  8.     EX
  9. End Sub
  10. Sub EX()
  11.     MsgBox CDate([gbkee])
  12. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 5# mhl9mhl9


    §Ú¥Î¹L2ºØ¤è¦¡¥hµ¹¤@­Ó»Ý­n«O¦s½á­ÈªºÅܼơG
1. ¦p GBKEE¤j¤j ªº¤è¦¡ ³]©w©w¸q¦WºÙ
2. ¬JµM¬O¦b EXCEL ¤º¨Ï¥Î¡A´N¦b¥i¯à¤£·|¥Î¨ìªº»·³BÀx¦s®æ°O°_¨Ó

TOP

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2018-8-20 17:05 ½s¿è

¦^´_ 2# mhl9mhl9
static ¬OÀRºAÅܼơA¸ò§½³¡ÅܼƤS¬O¤£¤@¼Ëªº¡C

¤½¥ÎÅܼÆPublic X ªº­È³]©w«á·|ºû«ù¨ì¬Æ»ò®É­Ô?
´N§Ú©Òª¾°£¤FÃö³¬excel¥~¡A¤U­±¥ô¤@ºØ³£·|±N¤½¥ÎÅܼƲM°£:
1. code ¤¤¦³°õ¦æ¨ì  End
2. «ö¤F­«·s³]©w³o«ö¶s
    Â^¨ú1.PNG
3. °»´ú¨ì¿ù»~®É«ö¤Fµ²§ô
   

°£¤F©w¸q¦WºÙ¡A­Y§A­n½á¤©Åܼƪº­È¬O¤£»Ý­n§ïÅܪº¡A¥i¥H§ï¥Î±`¼Æ
¦p Public Const X=123
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

        ÀR«ä¦Û¦b : §Ñ¥\¤£§Ñ¹L¡A§Ñ«è¤£§Ñ®¦¡C
ªð¦^¦Cªí ¤W¤@¥DÃD