excel - How to add folder
问题描述
Ok, I have a script of code. When I run it in Module 19 I get "Run-Time Error 76" "Path not Found" . But in my Module 18 the codes runs fine but it elates to different cells.
Sub Customer_Save()
' 302
Dim Tmp As String
Dim FldName As String
' 1. Create the name you want to search for before starting the search
' 2. don't refer to cells by their range names (too cumbersome)
FldName = ActiveWorkbook.Sheets("CUSTOMER INFO").Cells(3, 1).Text ' actually, it's Cells(3, 1)
Debug.Print FldName ' check the name
If Len(FldName) Then
Tmp = ActiveWorkbook.Sheets("CUSTOMER INFO").Cells(3, 7).Text
If Len(Tmp) Then
FldName = Tmp & "\" & FldName ' observe how to add the path separator
Debug.Print FldName ' check the name
FldName = ActiveWorkbook.path & "\CUSTOMER HISTORY\" & FldName
Debug.Print FldName ' check the name
If Dir(FldName) = vbNullString Then MkDir FldName
Else
MsgBox "Cell G3 is blank"
End If
Else
MsgBox "Cell A3 is blank"
End If
End Sub
解决方案
推荐阅读
- c++ - 如何在 C++ 中拆分无符号长整数
- css - 使网格列高适合自己的内容
- html - 将“过滤器”和“加载更多”功能与 jQuery 相结合 - 如何仅从当前选定的过滤器类别中加载项目
- mysql - 如何从mysql子查询中的另一个表中选择多行
- gis - 如何修复预览层地理服务器中的渲染错误显示?
- apache - Apache:多个虚拟主机和反向代理
- python - 如何使用列的值作为空间操作的输入
- excel - Excel 到 Word 的查找和替换 - 如何绕过 255 个字符的限制
- excel - 求月末加班总结的Excel公式
- java - auto.register.schemas 是否应该在修改 .avsc 时在模式注册表中创建一个新版本?