问题2: 把Sheet1的数据拷贝到新的Sheet里,并命名新的Sheet为SheetNew Private Sub Command1_Click() Dim objExcel As New Excel.Application Dim objBook As New Excel.Workbook Dim objSheet As New Excel.Worksheet
Set objBook = objExcel.Workbooks.Open("c:\test.xls", , True) objExcel.Visible = True
Sheets("Sheet1").Select
Sheets("Sheet1").Copy Before:=Sheets(1)
Sheets("Sheet1 (2)").Select
Sheets("Sheet1 (2)").Name = "SheetNew"
把Sheet1的数据拷贝到新的Sheet里,并命名新的Sheet为SheetNew
Private Sub Command1_Click()
Dim objExcel As New Excel.Application
Dim objBook As New Excel.Workbook
Dim objSheet As New Excel.Worksheet
Set objBook = objExcel.Workbooks.Open("c:\test.xls", , True) objExcel.Visible = True
objExcel.Sheets("Sheet1").Select
objExcel.Sheets("Sheet1").Copy Before:=Sheets(1) '复制数据
objExcel.Sheets("Sheet1 (2)").Select
objExcel.Sheets("Sheet1 (2)").Name = "SheetNew" '重新命名新的工作表
Set objExcel = Nothing
Set objBook = NothingEnd Sub