应用程序参数:Autocad 2013,64位Excel;2010年,32位错误:背景:我有一个例程(基于从网上获得的代码(大部分来自Fixo))从Excel打开ACAD;并将工作表值复制到;新创建的AutoCAD图形中的表
当我试图创建表时,一直收到错误代码91  ;该表已创建,但程序会退出到错误处理程序 ;错误处理程序被调出以继续下一步,程序继续,但不#039;t更新表格值
在创建表格之前,我将尝试创建表格样式,但现在我';我向真正了解自己的人寻求帮助';我们正在做 
我知道那个点。Net将是最佳的解决方案,但VSTO对于一个人来说有一个非常陡峭的学习曲线,即在工作时间而不是在工作时间
Excel VBA代码:
- ' Sub to create drawing with submittal text
- Sub ACADtxt(DataSheet As Worksheet) '
- Dim RowCount As Integer, iCount As Integer
- Dim tmpStr1 As String, tmpStr2 As String
- Dim FileName As String
- Dim acad As AcadApplication
- Dim adoc As AcadDocument
- Dim aspace As AcadBlock
- Dim Alayer As AcadLayer
- Dim entArray() As AcadEntity
- Dim ListTable As acadTable
- 'Dim insPt(2) As Double
- Dim insPt As Variant
- On Error GoTo ErrorHandler
- Dim appNum As String
- appNum = acadVerNum
- ' See if ACAD is on the computer
- If appNum = "" Then
- MsgBox "Sorry, but AutoCAD does not appear to be on this computer.", vbExclamation
- Exit Sub
- End If
- ' Start ACAD
- Set acad = CreateObject("Autocad.Application." & appNum)
- Set adoc = acad.ActiveDocument
- Set aspace = adoc.ActiveLayout.Block
- acad.Visible = True
- ' Create layers Text1 and Text2
- Call MakeSetLayer("Text1", 11)
- Call MakeSetLayer("Text2", 12)
- ' Now load the marked cells with the appropriate drawing # and title
- DataSheet.Activate
- ' See how many rows we need to check
- With ActiveSheet
- RowCount = .Range("A" & .Rows.Count).End(xlUp).row
- End With
- insPt = adoc.Utility.GetPoint(, vbCrLf & "Pick the upper left point of table:")
- ' Create the table
- ListTable = adoc.ModelSpace.AddTable(insPt, RowCount, 2, 3.5, 20#) ' 0 Then
- 'MsgBox Err.Description
- Stop
- End If
- End Sub
纠正了我的错误…
修改了…
- ListTable = adoc.ModelSpace.AddTable(insPt, RowCount, 2, 3.5, 20#) ' 0 Then
- MsgBox Err.Description
- Stop
- End If
- End Sub
|