¥»©«³Ì«á¥Ñ ffntldj ©ó 2011-12-1 20:17 ½s¿è
¹J¨ì¥H¤U°ÝÃD ¤W¨Ó¸ß°Ý¦U¦ì°ª¤â ½Ð½ç±Ð ÁÂÁÂ
¥H¤U¬O§Ú¼gªºcode (¤w§¹¦¨³¡¤À)
¥Dnªº¥\¯à¬O·Qn¥h'C:\tool\output\ ¦¹¥Ø¿ý¤U±¶}¸ÌÀYªº*.XLSÀÉ®×,¦ý¶}±ÒªºÀɮ׶·²Å¦X¥H¤U±ø¥ó
1:ÀɮצWºÙ»Ýn²Å¦X*ÀɦWÃöÁä¦r* ,Word=[b2] ¶ñ¼g¦bEXCELªí®æ¤¤
2.Sheet¦WºÙn²Å¦X"ShName",ShName=[b3] ¶ñ¼g¦bEXCELªí®æ¤¤
±µ¤U¨Ó¬O§Ú¤£ª¾¹D«ç»ò¼g(¥¼§¹¦¨),·Ð½ÐÀ°Ó¦£ ÁÂÁÂ
3.¥´¶}Àɮ׫á¦bSheet(Equi)¤¤,·íA+B+CÄæ¦ì¦pªG³£¤@¼Ë
«h±N¦¹¸ê®Æ«O¯d¤@µ§(¦pªþÀÉ2,3¦C),¤]´N¬O§R°£«½Æªº¸ê®Æ
4.¦bAÄæ¦ì¤¤¥un¦³¥]§tFilter1~3ªº¤º®e®É,n§â¸ê®Æ§R°£(°²³]filter1¼gªº¬O300#3_4MPMTR,«h²Ä¤»¦C¾ã¦C§R°£)
¦b'C:\tool\output\ªº¸Ì±·|¦³¦n´XÓÀÉ®× ©Ò¥H°µ§¹¤@ÓÀÉ®× ´NnÀx¦s Ãö±¼,µM«á¦b°µ¤U¤@Ó
¥H¤U¬O¤p§Ìªºcode
Private Sub CommandButton11_click()
Dim sh As Worksheet,NewBK As Workbook
Dim Path$,Word$,ShName$,File$,Tmp$,Filter1$,Filter2$,Filter3$
Path=[b1] 'C:\tool\output\
Word=[b2] 'ÀɦWÃöÁä¦r
ShName=[b3] 'sheet name (Equi)
Filter1=[b4]
Filter2=[b5]
Filter3=[b6]
File= Dir(Path&"*.xls") '¦¬´MÀÉ®×
if File="" then go to Ex
first =File
Do
Tmp=left(File,InStrRev(File,".")-1) '¨úÀɮצW
if InStr(File,Word) Then
Workbooks.open Path& File
On Error Resume Next
Set sh= ActiveWorkbook.Worksheets(ShName)
On Error GoTo 0
if Not sh is Nothing Then
i=i+1
'¦¹¬q¤£·|¼g'
sh.Parent.Close False
End If
End If
File= Dir
Loop Until first = File Or File= ""
IF i Then
msgbox i&"µ§²Å¦XÀÉ®×"
else
Newbk.close False
EX: Msgbox "µL²Å¦XÀÉ®×"
End if
End Sub |