乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 34|回复: 0

Excel VBA-在Autocad中创建表格-错误91-帮助?

[复制链接]

11

主题

40

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

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

纠正了我的错误…
修改了…
  1. ListTable = adoc.ModelSpace.AddTable(insPt, RowCount, 2, 3.5, 20#) '  0 Then
  2.         MsgBox Err.Description
  3.         Stop
  4.     End If
  5. End Sub
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-6-29 13:07 , Processed in 0.811385 second(s), 55 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表