' 在文件夹不存在的情况,建立一个文件夹
Sub createDir(pathName As String)
Dim tmpDir As String
On Error Resume Next
tmpDir = Dir(pathName)
If tmpDir = "" Then
MkDir pathName
End If
End Sub
' 获取当前 sheet 的最后一行的行号
Dim ct As Long
ct = sheet.UsedRange.Row + sheet.UsedRange.Rows.Count - 1
'新建一个 excel 文件
Sub AddNew(fName As String, sheet As Worksheet, ByRef rowIdx As Long)
Set newbook = Workbooks.Add
' Call copyHeader(sheet, newbook.Sheets(1), rowIdx)
rowIdx = rowIdx + 1
' Call copyBody(sheet, newbook.Sheets(1), rowIdx)
With newbook
.Title = ""
.Subject = ""
.SaveAs fileName:=fName
End With
newbook.Close
End Sub