A. 如何在Excel中用VBA创建文件夹
在Excel中用VBA创建文件夹:
1、在excel中创建点击按钮
B. 怎样用VBA在EXCEL中建立一个文件夹
sub abc()
on error resume next
mkdir thisworkbook.path & "\temp"
end sub
'temp为文件夹名
C. 如何在Excel中用VBA创建文件夹
可以用MkDir语句。
用法:
MkDir 路径\新文件夹名称
例如:
MkDir "d:\ExcelWj\示例"
注:如果此目录下已有“示例”文件夹,则会产生错误。
D. 如何使用excelVBA在指定路径下批量新建指定文件夹
Sub GetFolder()
Dim FolderName, FileName, MyFolder, MyFile As String
FolderName = "abc"
FileName = "abc.xls"
MyFolder = Dir("D:\" & FolderName, 16)
MyFile = Dir("D:\" & FolderName & "\" & FileName, 16)
If MyFolder <> "" Then
MsgBox "The folder is OK"
Else
MkDir "D:\" & FolderName
End If
If MyFile <> "" Then
MsgBox "The File is OK"
Else
Open "D:\" & FolderName & "\" & FileName For Output As #1
Close #1
End If
End Sub