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