赞
踩
Workbook工作簿的常用功能:
1. 新建工作簿
- Dim wb As Workbook
- Application.SheetsInNewWorkbook = 1 '设置初始工作簿中的工作表数
- Set wb = Application.WorkBooks.Add
- wb.Worksheets(1).name = "表1" '给第一个工作表设置名称
- Application.SheetsInNewWorkbook = 3
- Dim fileInfo As String
- fileInfo = Application.GetOpenFilename("Excel 工作簿(*.xlsx), *.xlsx")
- MsgBox fileInfo
3. 备份(另存为)Excel文件
- Dim wb As Workbook
- Set wb = Application.WorkBooks(1) '原文件名为vba.xlsx
- wb.Activate
- wb.SaveCopyAs wb.path & "\" & "Bak_" & wb.name '备份文件名为Bak_vba.xlsx
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。