更改新工作簿中的默认工作表数
在新的 Excel 工作簿中创建的出厂默认工作表数通常设置为 3。你的 VBA 代码可以显式设置新工作簿中的工作表数。
'--- save the current Excel global setting
With Application
Dim oldSheetsCount As Integer
oldSheetsCount = .SheetsInNewWorkbook
Dim myNewWB As Workbook
.SheetsInNewWorkbook = 1
Set myNewWB = .Workbooks.Add
'--- restore the previous setting
.SheetsInNewWorkbook = oldsheetcount
End With