vba - 在 VBA 中合并文件夹并跳过错误
问题描述
我正在合并两个文件夹,但可能需要创建新的子文件夹,因此我需要查看是否存在子文件夹,如果不创建新文件夹,请移动文件夹中的文件,如果文件不存在则跳过错误正在检查的列表。这是源的 excel 表
Sub MoveFiles()
fileLocation = "/Users/wynandgoosen/Downloads/SULL/Drive/About/" 'change to the top level parent folder
Range("A2").Select
'loop through all records in the list
'identifieswhich have been marked as archive
'move the marked files to the ARCHIVE folder
Do While ActiveCell.Value <> ""
If ActiveCell.Offset(0, 3).Value = "Move" Then
Name ActiveCell.Offset(0, 2).Value & "/" & ActiveCell.Offset(0, 1).Value As _
fileLocation & ActiveCell.Value & "/" & ActiveCell.Offset(0, 1).Value
On Error Resume Next
ActiveCell.Offset(0, 2).Value = fileLocation
ActiveCell.Offset(0, 3).Value = "YES"
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub
解决方案
推荐阅读
- angular - 根据当前会话值将登录/退出按钮添加到侧边栏
- mysql - 具有两个父级的 MySQL 表 - 在行删除期间,删除不会级联 - Google Cloud SQL
- reactjs - 在组件中设置类型?
- javascript - 设置复选框列表的样式
- python - 如何修复“ValueError:提供的数据在使用特征大小 17721 进行训练时具有 1 个维度”使用 sklearn LDA 模型进行预测
- milo - 有人检查在 kubernetes 环境中工作的 milo 服务器上的订阅行为吗?
- c# - 动态添加条件,无需每次都重新部署
- wordpress - $wpdb->insert 一次添加 3 行
- python - 为什么我的 contextProcessor 不适用于所有模板?django 2.2.1
- amazon-web-services - Amazon Elasticsearch - 无法访问 Kibana