保存为vbs在xls目录运行
- On Error Resume Next
- Dim fName
- Set objFS = CreateObject("Scripting.FileSystemObject")
- Set objFolder = objFS.GetFolder(".")
- readxls("Bok")
- readxls("")
- msgbox "完成"
- Set objFS = Nothing
- Set objFolder = Nothing
- Function readxls(str)
- For each f in objFolder.Files
- fName=split(f.Name,"_")
- If right(f.Name,4) = ".xls" and ubound(fName)=2 and fName(0) <> str then
- Set oExcel = CreateObject( "Excel.Application")
- oExcel.WorkBooks.Open(createobject("wscript.shell").currentdirectory&"\Bok_"&fName(1)&"_"&fName(2))
- fName1=oExcel.Cells(4,4).Value
- oExcel.Quit
- Set oExcel = Nothing
- f.Name= fName1&" "&fName(0)&".xls"
- End If
- Next
- End Function
复制代码
[ 本帖最后由 qaz123654 于 2010-7-15 12:40 编辑 ] |