- ©«¤l
- 4901
- ¥DÃD
- 44
- ºëµØ
- 24
- ¿n¤À
- 4916
- ÂI¦W
- 256
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 20xx
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2010-4-30
- ³Ì«áµn¿ý
- 2024-11-26
|
[Âà¶K] ¦ÛqApplicatoin¨Æ¥ó/ºÊ±±©Ò¦³¬¡¶Ã¯/°µ¦¨¼W¯q¶°
¥»©«³Ì«á¥Ñ Hsieh ©ó 2010-5-10 15:45 ½s¿è
³oÓ¥t¦s³Æ¥÷Àɪº¨Ò¤l¡A
¬O§Q¥Î Workbook_BeforeSave ¨Æ¥ó --
http://gb.twbts.com/index.php/topic,1661.0.html
¦pªG¦³³\¦hÀɮ׳£n¦s³Æ¥÷¡AÃø¹D¨CÓÀɳ£n·Ó§@¤@¦¸¶Ü??
¤]³\¤£¤Ö¤Hª¾¹D¦³¤@³Ò¥Ã¶hªº¿ìªk¡G
¦Ûq¤@Ó¥i¥HºÊ±±©Ò¦³¬¡¶Ã¯ªºApplication¨Æ¥ó¡A¦A°µ¦¨¼W¯q¶°¡C
²{±N¥¦¹ê§@¹Lµ{¼g¥X¨Ó¡A¤è«K¤j®a°Ñ¦Ò¡G
1. ¶}±Ò·s¬¡¶Ã¯¡A«ö Alt-F11 ¤Á´«¦Üµ{¦¡½s¿è¾¹¡C
2. ´¡¤J > ª«¥óÃþ§O¼Ò²Õ (¹w³]¦WºÙ¬° Class1)¡C
3. ¦¹®É·|¶}±Ò¤@Ӫťժºµ{¦¡½s¿è°Ï¡A½Ð¿é¤J¥H¤Uµ{¦¡½X¡G
Public WithEvents App As Application
µù¡G App ¬O¦Ûq¦WºÙ¡C³o¥y·N«ä¬O¦Ûq¤@Ó§t¦³¨Æ¥óªºApplicationª«¥ó¡C
4. «ö¤U Enter «á¡A½s¿è°Ï¥ª¤W¤èªºª«¥ó¿ï³æ¤¤·|¦h¥X¤@Ó App ¡C
ÂI¿ï App¡A«h¥k¤W¤èªº¿ï³æ·|¦C¥X³oÓApplicationª«¥ó¥i¥Îªº¨Æ¥ó¡C
5. ¦b¥i¥Î¨Æ¥ó¤¤ÂI¿ï WorkbookBeforeSave¡A«h·|¦b½s¿è°Ï²£¥Í¤@ӪŪº¨Æ¥ó¡G
Private Sub App_WorkbookBeforeSave(ByVal Wb As Workbook, ByVal SaveAsUI As Boolean, Cancel As Boolean)
End Sub
¥E¬Ý«Ü¹³¤§«eºD¥Îªº Workbook_BeforeSave ¨Æ¥ó¡A®t§O´N¦b©ó Workbook_BeforeSave ¥u¯àºÊ±±µ{¦¡©Ò¦b¬¡¶Ã¯ªº¦sÀÉ¡A¦Ó³oÓ App_WorkbookBeforeSave ¥iºÊ±±©Ò¦³¬¡¶Ã¯ªº¦sÀɰʧ@¡C
6. ²{¦b¥i§â¥t¦s³Æ¥÷ªºµ{¦¡½X®M¤J³oӨƥó.. ¦ý¬Onµy§ï¤@¤U¡G
Private Sub App_WorkbookBeforeSave(ByVal Wb As Workbook, ByVal SaveAsUI As Boolean, Cancel As Boolean)
¡@¡@Wb.SaveCopyAs "C:\TEMP\" & Wb.Name
End Sub
7. ±µµÛ¦A©óµ{¦¡½s¿è¾¹¥\¯àªí ´¡¤J > ¼Ò²Õ¡A¦b·s¶}¥Xªº½s¿è°Ï¿é¤J¥H¤Uµ{¦¡¡G
Public xlApp As New Class1 '«Å§i xlApp ¬°¤W±¦Ûqªºª«¥ó¼Ò²Õ
Sub Auto_Open() 'Auto_Open·|¦b¦¹Àɶ}±Ò®É¦Û°Ê°õ¦æ
¡@¡@Set xlApp.App = Application
¡@¡@'§â¦Ûq¼Ò²Õªº App ³]¬°(¤]¥i»¡³sµ²¨ì)Applicationª«¥ó
End Sub
OK¡Aµ{¦¡ªº³¡¤À¨ì¦¹¬°¤î¡F«ö Alt-Q Â÷¶}µ{¦¡½s¿è¾¹¡C
8. ±N¦¹Àɮצs¬° ¼W¯q¶° (°ÆÀɦW¬° XLA)¡A¨Ã¥BÃö³¬¡C
9. ÂI¿ï¥\¯àªí ¤u¨ã > ¼W¯q¶°... > ÂsÄý... ¸ü¤Jè¤~°µ¦nªº¼W¯q¶°¡C
¦n¤F¡A§A¥iÀH·N¥´¶}¨ä¥L¬¡¶Ã¯¡B½s¿èµM«áÀx¦s¡A¸Õ¸Õ¦Û¤v°µªº¦¨ªG¡C
·íµM¡A§A¥i¦b²Ä 4¡B5 ¨BÆJ¿ï¾Ü¨ä¥L¨Æ¥ó¨Ã½s¼g§A·Qnªºµ{¦¡¡A¨É¨ü»´ÃP¾Þ±±©Ò¦³¬¡¶Ã¯ªº§Ö·P~
¬Ý¾¤]³\ı±o¡G«ç»ò³o¼Ë³Â·Ðªü??
¦p¦P¤WzªºApplicationª«¥ó¥H¤Î¤§«eÁ|¹L¤@¨Ç¨Ò¤lªº±±¨î¶µ¸s²Õª«¥óµ¥µ¥¡AOffice¦³³\¦hª«¥ó©M¨ä¨Æ¥ó¤£¬O¹w³]ªº¡A¦Ó¨Æ¥óªºµ{¦¡½X¤S¥²¶·¨Ìªþª«¥ó¼Ò²Õ¡A©Ò¥H¥²¶·¦Ûqª«¥ó¼Ò²Õ¡C³o¨Ç¨Ã«D±`¥Î¥\¯à¡A¦ýVBA¤´µM«O¯d¤F¦Ûq»P©µ¦ùªºªÅ¶¡µ¹¨Ï¥ÎªÌ --
¦Ó¥B¥un¾Ç·|À³¥Î¡A¥iµo´§«Ü¤jªº®Ä¯q¡C |
|