Private Sub Ren_unicodeFile() Dim Fso, FsoFldr Dim sFile, shrFile, lngFile As String , ib As Long Dim sF1 As String , sF2 As String , sPath1 As String If 1 = 1 Then CommonDialog1.FileName = "*.htm" CommonDialog1.ShowOpen sF1 = CommonDialog1.FileName sPath1 = Left(sF1, InStrRev(sF1, "\")) sF2 = "r:\new\test.htm" Set Fso = CreateObject( "Scripting.FileSystemObject" ) Set FsoFldr = Fso.GetFolder(sPath1).Files For Each sFile In FsoFldr lngFile = sFile.Name ib = InStr(lngFile, ChrW(160)) If LCase(sFile.shortName) Like "*.htm" And ib > 0 Then shrFile = sFile.ShortPath Name shrFile As sF2 End If Next ElseIf 1 = 0 Then Set Fso = CreateObject( "Scripting.FileSystemObject" ) If Fso.FolderExists(sPath) Then For Each sFile In Fso.GetFolder(sPath).Files Set FsoFile = Fso.GetFile(sFile) shrFile = FsoFile.ShortPath Name shrFile As "r:\new\" & Format(I, " 0000 ") & " .txt" I = I + 1 Next End If End If Set Fso = Nothing MsgBox "OK" End Sub |