请教GetObject(, "AutoCAD.Application")语句的应用?
Private Sub Command1_Click()<BR>On Error Resume Next<BR>Dim dwgname As String<BR>dwgname = "c:\Test.dwg" '测试用,事先画一张Test.dwg<BR>If Dir(dwgname) <> "" Then<BR> Dim acadApp As AcadApplication<BR> Set acadApp = GetObject(, "AutoCAD.Application.14") <FONT color=#22dd92> <FONT color=#39de10> '原先测试时是(,"AutoCAD.Application"),程序可以运行</FONT><BR></FONT> If Err Then<BR> Err.Clear<BR> <FONT color=#ff0000>Set acadApp = CreateObject("AutoCAD.Application.14")<BR></FONT> If Err Then<BR> MsgBox Err.Description<BR> Exit Sub<BR> End If<BR> End If<BR> <BR> Dim acadDoc As AcadDocuments<BR> Set acadDoc = acadApp.Documents<BR> acadDoc.Open (dwgname)<BR> acadApp.Visible = True<BR> acadApp.ZoomExtents<BR>Else<BR> MsgBox "文件" & dwgname & "不存在,"<BR>End If<BR>End Sub原程序在第7行时是Set acadApp = GetObject(, "AutoCAD.Application"),该程序可以通过AutoCAD2002打开图纸Test.dwg,现因某些原因需要通过AutoCAD R14来打开图纸。(系统中装有CAD2002和CAD-R14) ,但做了相应更改后,程序报错:类型不匹配!请问这是什么原因??
页:
[1]