excel - 使用 Excel 和 VBA 打开文件(在 Mac 上)
问题描述
在为我的客户完成宏之后,他告诉我他有一台 Mac。我试图调整 Mac 的代码,但我没有 Mac 来测试它。我有 Mac 的朋友试图帮助我,但他没有任何运气。
我需要在 Matters 文件夹中找到所有文件名并将它们放在 B 列中。我需要在 RCTI 文件夹中找到所有文件名并将它们放在 D 列中。
我希望这行代码可以解决问题,但事实并非如此。
strFile = Dir(strPath, MacID("XLSX"))
我的朋友运行宏并出现错误。他无法真正向我解释这个错误。
Matters = Range("B3").Text
strPath = Matters
strFile = Dir(strPath, MacID("XLSX"))
Row = 7
Do While strFile <> ""
Range("B" & Row).Value = strFile
Row = Row + 1
strFile = Dir 'This moves the value of strFile to the next file.
Loop
Matters = Range("B3").Text
strPath = Matters
strFile = Dir(strPath, MacID("CSV"))
'strFile = Dir(strPath & "*.csv")
Do While strFile <> ""
Range("B" & Row).Value = strFile
Row = Row + 1
strFile = Dir 'This moves the value of strFile to the next file.
Loop
RCTI = Range("B4").Text
strPath = RCTI
strFile = Dir(strPath, MacID("XLSX"))
Row = 7
Do While strFile <> ""
Range("D" & Row).Value = strFile
Row = Row + 1
strFile = Dir 'This moves the value of strFile to the next file.
Loop
RCTI = Range("B4").Text
strPath = RCTI
strFile = Dir(strPath, MacID("CSV"))
Do While strFile <> ""
Range("D" & Row).Value = strFile
Row = Row + 1
strFile = Dir 'This moves the value of strFile to the next file.
Loop
解决方案
推荐阅读
- android - 是否可以在android中提取和检查联系人的数据库文件
- typescript - Redux 可以假设性地推断传递给它的 mapStateToProps 的类型吗?
- javascript - React Native:“通过带有变量 xy z 的 HTTP Post 重定向用户”是什么意思?
- reactjs - index.js:1375 警告:组件正在更改要控制的文本类型的不受控制的输入
- c# - 导致异常“只读控件集合” - 编辑 UI 时
- android - 在创建 sqflite 数据库时插入记录
- java - DateTimeFormatter 为日期字符串抛出 DateTimeParseException
- php - 如何在 URL 中实现 escapeshellarg?
- javascript - 类内部的函数未定义
- javascript - 通过 npm 导入后无法使用 lib