VBA 实现批量excel文件复制

对于每天要将文件复制到其他多个路径

1 在test文件下新建3个子文件夹  test1,test2,test3
2 在test1下新建li01.xlsx,li02.xlsx,hua01.xlsx,hua02.xlsx和文件夹li1
3 新建宏,并制作按钮键
4 fs.copyfile "文件路径","目标路径",True(是否覆盖重名文件)
  fs.copyfolder "文件夹路径","目标路径",True(是否覆盖重名文件)

Sub copy()

Set fs = CreateObject("Scripting.FileSystemObject")
  

fs.copyfolder "E:	est	est1li1",  "E:	est	est3", True '复制文件夹到指定目录

fs.copyfile "E:	est	est1hua*.xlsx", "E:	est	est3", True   '复制文件到指定目录

fs.copyfile "E:	est	est1li*.xlsx", "E:	est	est3", True   '复制含通配符的文件到指定目录



msgbox("well done!")  '运行成功提示

End Sub

原文地址:https://www.cnblogs.com/li-volleyball/p/5485185.html