提示800A400c,能帮忙看下是哪里出问题吗?谢谢

m0_46067761 2020-07-30 03:20:50
Set fso = createobject("scripting.filesystemobject") curdir = fso.getparentfoldername(wscript.scriptfullname) fhtdir = fso.buildpath(curdir,"FHT") fctdir = fso.buildpath(curdir,"FWZP") dfcdir = fso.buildpath(curdir,"茶山村") Set reg = createobject("vbscript.regexp") reg.Global = False reg.ignorecase = True reg.multiline = False movefiles fhtdir,dfcdir,"(\w{19})(\w{5})_FHT","房产分户图" movefiles fctdir,dfcdir,"(\w{19})(\w{5})_FWZP","房屋照片" msgbox "done!" Sub MoveFiles(ByVal srcdir, ByVal destdir, ByVal strpattern, ByVal strsubdir) reg.pattern = strpattern For Each objfile In fso.getfolder(srcdir).files strbasename = fso.getbasename(objfile.name) If reg.test(strbasename) Then Set objmatch = reg.execute(strbasename)(0) part1 = objmatch.submatches(0) part2 = objmatch.submatches(1) dir1 = getmatchdir(destdir,part1) If dir1 <> "" Then dir2 = getmatchdir(dir1,part1 & part2) If dir2 <> "" Then dir3 = fso.buildpath(dir2,strsubdir) Else dir3 = fso.buildpath(dir1,strsubdir) End If If fso.folderexists(dir3) Then objfile.move fso.buildpath(dir3,objfile.name) End If End If End If Next End Sub ' 得到以指定名称开头的子文件夹路径; Function GetMatchDir(ByVal pntdir, ByVal strbase) For Each objdir In fso.getfolder(pntdir).subfolders If Len(objdir.name) >= Len(strbase) Then If StrComp(Left(objdir.name,Len(strbase)),strbase,1) = 0 Then getmatchdir = objdir.path Exit Function End If End If Next getmatchdir = "" End Function
...全文
39 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

2,463

社区成员

发帖
与我相关
我的任务
社区描述
VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
社区管理员
  • VBA
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧