在VBA中引用EXCEL 对象后如何弹出EXCEL保存对话框?
<P>我是一个VBA入门者,请问在VBA中引用EXCEL 对象后如何弹出EXCEL保存对话框?</P><P>Sub PgDxx()<BR> Dim Excel As Excel.Application<BR> Dim ExcelSheet As Object<BR> Dim ExcelWorkbook As Object<BR> Dim RowNum As Integer<BR> Dim HeadTF As Boolean<BR> Dim Elem As AcadEntity<BR> Dim Array1 As Variant<BR> Dim Count As Integer<BR> Set Excel = New Excel.Application<BR> Set ExcelWorkbook = Excel.Workbooks.Add<BR> Set ExcelSheet = Excel.ActiveSheet<BR><FONT color=#ff3333> ExcelWorkbook.SaveAs "d:\dwgdata.xls"<BR></FONT> ExcelSheet.Cells(1, 1).Value = "点号"<BR> ExcelSheet.Cells(1, 2).Value = "方位"<BR> ExcelSheet.Cells(1, 3).Value = "平距"<BR> ExcelSheet.Cells(1, 4).Value = "高程"<BR> DIS = 0<BR> For i = 1 To 200<BR> ExcelSheet.Cells(i + 1, 1).Value = i<BR> pt(i) = vbCrLf & "捕捉剖面图切点:"<BR> hint(i) = ThisDrawing.Utility.GetPoint(, pt(i))<BR> H(i) = vbCrLf & "输入该点高程(结束请输入“0”):"<BR> On Error Resume Next<BR> Hi(i) = ThisDrawing.Utility.GetReal(H(i))<BR> If Hi(i) = 0 Then Exit For<BR> ExcelSheet.Cells(i + 1, 4).Value = Hi(i)<BR> If i > 1 Then<BR> DIS = GetDIS(hint(i), hint(i - 1)) + DIS<BR> angle = GetAngle(hint(i - 1), hint(i))<BR> End If<BR> If i > 1 Then ExcelSheet.Cells(i, 2).Value = Format(angle, "###")<BR> ExcelSheet.Cells(i + 1, 3).Value = Format(DIS, "####.00")<BR> <BR> Next i<BR> ' Close the recordset and the database connection<BR> ExcelWorkbook.Close<BR> Excel.Application.Quit<BR>End Sub</P>
<P>我希望在红字处弹出EXCEL保存对话框,哪位大哥能告诉我。小弟在此谢过了。!!!</P> 你可以调用VB中的保存对话框呀 <P>实在是不好意思,zhul,我也不知道如何调用VB中的保存对话框,望指点,多谢多谢</P> <P>多谢,我经过一宿的研究终于搞定。多谢了,zhul</P> <P>要是不会调用保存对话框就自己做一个Form,也是个变通的方法,速度也不会慢到哪去......</P>
页:
[1]