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

[µo°Ý] »yªk°ÝÃD

[µo°Ý] »yªk°ÝÃD

¥»©«³Ì«á¥Ñ pitera88 ©ó 2012-1-4 20:03 ½s¿è

object.Delete force

½Ð°Ý«e­±ªºobject­n«ç»ò¿é¤Jªü??§Ú¬O·Q«ü©w¬Y­Ó¸ê®Æ§¨¡A¨Ò¦p¡G"c:\456\" §Ú¥ÎÅܼƤ]¤£¯à¥Î­C

¦Ñ®vÁÙ¨S±Ð¨ì³o¡A¥ý¨Ó°Ý°Ý

§Ú¬O·Q§R¬Y­Ó¸ê®Æ§¨ùتºÀɮסA¤£¬O¬¡­¶Ã¯ùتº¤º®e®@
¤¯¥S

¥»©«³Ì«á¥Ñ HSIEN6001 ©ó 2012-7-12 12:18 ½s¿è

¦^´_ 12# GBKEE


§Ú²×©ó·Q³q¤F^^
[¤w¸Ñ¨M]
  1. Sub EX()
  2.     Dim F As String, xpath As String, xfile As String
  3.     xpath = "D:\´ú¸Õ\"   
  4.     xfile = Dir(xpath & "ANY*.xls")
  5.     Do While xfile <> ""
  6.         With Workbooks.Open(xpath & xfile)
  7.         If Sheets(1).Range("A2") <> "¤é´Á" Then
  8.             With ActiveWorkbook
  9.                 F = .FullName      '¶Ç¦^ª«¥óªº¦WºÙ¡A¥]¬A¨äºÏºÐ¸ô®|
  10.                 .Close 0           'Ãö³¬ÀÉ®×
  11.             End With
  12.         End If
  13.     Kill F     '§R°£ÀÉ®×"123.xls
  14.         End With
  15.         xfile = Dir
  16.     Loop
  17. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ HSIEN6001 ©ó 2012-7-12 12:14 ½s¿è

¦^´_ 14# GBKEE

½Ð°ÝGBKEE¤j,¦p¦ó§¹¦¨

»Ý¨D¡G
¸ê®Æ§¨¤º "ANY*.xls" ªº©Ò¦³ÀɦW
¦pªG¸Óªí®æSheets(1).Range("A2") <> "¤é´Á"
´N§R°£¸ÓÀÉ®×.xls
  1. Sub Ex()
  2. Dim F As String, xpath As String, xfile As String
  3. xpath = "D:\´ú¸Õ\"
  4. xfile = Dir(xpath & "ANY*.xls")
  5.     Do While xfile <> ""
  6.         If Sheets(1).Range("A2") <> "¤é´Á" Then
  7.             With ActiveWorkbook
  8.                 F = .FullName      '¶Ç¦^ª«¥óªº¦WºÙ¡A¥]¬A¨äºÏºÐ¸ô®|
  9.                 .Close 0           'Ãö³¬ÀÉ®×
  10.             End With
  11.             Kill F     '§R°£ÀÉ®×"123.xls
  12.         End If
  13.         xfile = Dir
  14.     Loop
  15. End Sub
½Æ»s¥N½X
°õ¦æµ²ªG·|ª½±µÃö³¬¥¨¶°¸ÓÀÉ®×

TOP

¦^´_ 13# linsurvey2005
¥u¯àÃö³¬Àɮפ£¯à¾ã­Ó§R°£(¥]§t©U§£±í¤]¬O)
¬O123.xlsÀɮפ£¯à§R°£¶Ü? ,  ½Ð°Ý  Sheets(1).Range("A1")   ¬O 123.xlsªºSheets(1) ,
¨º·íµM§R¤£±¼
           .Close 0           '¥ýÃö³¬ÀÉ®×
        End With
        Kill F     '§R°£ÀÉ®×"123.xls ¨S¿ìªk°õ¦æ


¦]¬°§Aªº»¡ªº¤£¬O«Ü²M·¡!!

TOP

¦^´_ 12# GBKEE


GBKEE «e½ú¦n:
¥u¯àÃö³¬Àɮפ£¯à¾ã­Ó§R°£(¥]§t©U§£±í¤]¬O)~^.^
¤ñ¤è»¡Àɮצs©ñ¸ô®|"D:\test¾ã­Ó®ø¥¢¦b¹q¸£\123.xls"----¸ò¦s©ñ¸ô®|¦³®t§O¶Ü?
¸ô®|¦Û°Ê§ì¨ú¤ñ¸û¤è«K~½Ð±Ð¦³¤T
¶}¤ß¾Ç²ß,¾Ç²ß«Ü¶}¤ß

TOP

¦^´_ 11# linsurvey2005
  1. Sub Ex()
  2.     Dim F As String
  3.     If Sheets(1).Range("A1") <> "123" Then
  4.         With ActiveWorkbook
  5.             F = .FullName      '¶Ç¦^ª«¥óªº¦WºÙ¡A¥]¬A¨äºÏºÐ¸ô®|
  6.             .Close 0           'Ãö³¬ÀÉ®×
  7.         End With
  8.         Kill F     '§R°£ÀÉ®×"123.xls
  9.     End If
  10. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ linsurvey2005 ©ó 2012-1-12 16:16 ½s¿è

¦^´_ 7# lcc_seven


    lcc_seven «e½ú¦n:
    «ç»ò¹B¥Î¦b¤w¸g¶}±ÒªºÀÉ®×
       ¤ñ¦p:¤w¸g¶}±ÒÀÉ®×"123.xls",±ø¥ó¤£²Å´N§R°£ÀÉ®×"123.xls"
           ±ø¥ó¦¡ IF Sheets(1).Range("A1") <> "123" Then  ActiveWorkbook.Name.Delete   '§R°£ÀÉ®×"123.xls"
¶}¤ß¾Ç²ß,¾Ç²ß«Ü¶}¤ß

TOP

¦^´_ 9# GBKEE


    ÁÂÁÂgbkee¤j¤j¡A¨ü±Ð¤F

·P®¦¡A§V¤Ok¤å
¤¯¥S

TOP

¦^´_ 6# pitera88


   

TOP

¦^´_ 6# pitera88

¦pªG­n§R°£¸ê®Æ§¨

Sub DeleteFolder()
Dim FSO As Object
Dim DelFolder As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
Set DelFolder = FSO.GetFolder("D:\·s¸ê®Æ§¨")
DelFolder.Delete
End Sub

PS¡Gª½±µ§R°£¡A¤£·|´£¥Ü¸ê®Æ§¨¸Ì­±¬O§_¦³ÀɮסC

TOP

        ÀR«ä¦Û¦b : ¦³®É·í«äµL®É­W¡A¦n¤Ñ­n¿n«B¨Ó³¡C
ªð¦^¦Cªí ¤W¤@¥DÃD