回覆列表
  • 1 # Tiekt鐵鐵

    Option ExplicitSub test1() Dim wb As Workbook Set wb = Workbooks.Add With wb.Worksheets .Add After:=wb.Worksheets(.Count), Count:=5 - .Count End With "以下是可選程式碼 "將新建的工作簿啟用為當前視窗 wb.Activate "將工作簿儲存到D盤根目錄,名字為newWorkbook.xlsx, 格式為.xlsx格式(excel2007及以上版本預設格式) wb.SaveAs "D:\newWorkbook.xlsx", 56 End SubSub test2() "如果是從外部程式建立,如在word中執行操作,則需要先建立個excel物件。 Dim appExcel As Excel.Application Dim wb As Workbook Set appExcel = CreateObject("Excel.Application") Set wb = appExcel.Workbooks.Add With wb.Worksheets .Add After:=wb.Worksheets(.Count), Count:=5 - .Count End WithEnd Sub

  • 中秋節和大豐收的關聯?
  • 一個木一個監是什麼字?