帮忙解释一下(WITH 和 END WITH)?不胜感激!Private Sub Command2_Click()Dim VBExcel As Excel.ApplicationSet VBExcel = CreateObject("Excel.Application")With VBExcel.Workbooks.AddWith ActiveWorkbook.SaveAs "C:\Documents and Settings\Administ

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 06:26:32

帮忙解释一下(WITH 和 END WITH)?不胜感激!Private Sub Command2_Click()Dim VBExcel As Excel.ApplicationSet VBExcel = CreateObject("Excel.Application")With VBExcel.Workbooks.AddWith ActiveWorkbook.SaveAs "C:\Documents and Settings\Administ
帮忙解释一下(WITH 和 END WITH)?不胜感激!
Private Sub Command2_Click()
Dim VBExcel As Excel.Application
Set VBExcel = CreateObject("Excel.Application")
With VBExcel
.Workbooks.Add
With ActiveWorkbook
.SaveAs "C:\Documents and Settings\Administrator\桌面\222.xls"
.Close
End With
.Quit
End With
End Sub
主要解释WITH 和END WITH之间的那部分!
看不懂!有点怪怪的!

帮忙解释一下(WITH 和 END WITH)?不胜感激!Private Sub Command2_Click()Dim VBExcel As Excel.ApplicationSet VBExcel = CreateObject("Excel.Application")With VBExcel.Workbooks.AddWith ActiveWorkbook.SaveAs "C:\Documents and Settings\Administ
With 语句可以对某个对象执行一系列的语句,而不用重复指出对象的名称.例如,要改变一个对象的多个属性,可以在 With 控制结构中加上属性的赋值语句,这时候只是引用对象一次而不是在每个属性赋值时都要引用它.下面的例子显示了如何使用 With 语句来给同一个对象的几个属性赋值.
With MyLabel
.Height = 2000
.Width = 2000
.Caption = "This is MyLabel"
End With