¥»©«³Ì«á¥Ñ white5168 ©ó 2012-5-6 23:23 ½s¿è
¬ÛÃöªºµ{¦¡½X¦p¤U- Option Explicit '±j¨îÀɮפ¤ªº©Ò¦³ÅܼƳ£»Ý©ú½T«Å§i
½Æ»s¥N½X- Sub ExcelVBACallVBScript()
- Dim vbscript: Set vbscript = CreateObject("msscriptcontrol.scriptcontrol") 'ª½±µ«Å§i¤@ӨϥΠMicrosoft Script control 1.0ªºª«¥ó, ¨Ï¥ÎCreateObject¤è¦¡¥i¥H§K°£¦b "³]©w¤Þ¥Î¶µ¥Ø" ¤Ä¿ïMicrosoft Script control 1.0¶µ¥Ø
- vbscript.Language = "vbscript" '¿ï¾Ü©Òn¨Ï¥ÎªºScript»y¨¥,¥i¥H¨Ï¥ÎªºScript,¦pJavaScript, VBScript
- vbscript.AddCode "sub aa(): msgbox ""hello.."":end sub " '¨Ï¥ÎVBA¼g¤@¬qvbscriptªºµ{¦¡½X,¨Ã©R¦W¦¹¬qµ{¦¡½Xªº¨ç¼Æ¦WºÙ¬°aa,aaªº¨ç¼Æn°µªº°Ê§@¬O°µÅã¥Ü"hello.."
- vbscript.Run "aa" '¨Ï¥ÎVBA¥h©I¥sèè¼g¦nªºvbscript aa()ªº¨ç¼Æ
- End Sub
½Æ»s¥N½X PS:¨¬°Programmer¸Ó¦bµ{¦¡¤º¥[¤Wµù¸Ñ,¥H¤è«K¥¼¨Ó¦^ÀY½Æ²ß®É¥i¥H§Ö³t¤F¸Ñ,¤]Åý¨ä¥L¤H¥i¥H¶¶§Q¾Ç²ß,½Ð¾i¦¨¨}¦nµ{¦¡¼¶¼g®É¥[µù¸Ñªº²ßºD |