I am trying to run an AutoCAD application from an Excel spreadsheet which is generated by a VB application and I need to add an AutoCAD refences dynamically in MS Excel.
How can I do it?
Hey, TW, I don't have answer for ya, but I think I'm looking for almost the same thing that you are! I am trying to create a front end in MS Access which will write a file (preferably text) with commands that can be input into Autocad to draw objects.
It looks like forms and VB can be coded within AutoCad; however, I need to be able to specify my parameters (line commands) in my Access app
I'm a COBOL mainframer by trade; therefore, I am a beginning beginner w/autocad.
Please put a post here if you find out how to do this by other means of this site.
thanx....Rusty
Here is a code that will allow you to open a drawing and manipulate a block from MS Access:
1) Add an object library reference. Open any module and Select Tools -> References - > AutoCAD 2000 Type Library (ACAD.TLB) file
Public acadApp As Object
Public acadDoc As AcadDocument
' This will open an AutoCAD application
Set acadApp = CreateObject("Autocad.Application")
Set acadDoc = acadApp.ActiveDocument
acadApp.Visible = True
'open a drawing that you want to manipulate
acadDoc.Open strDrawingName & strDrawingPath
'select an autocad block that you want to manipulate
Set acBlockRef = acadDoc.HandleToObject(strHandle)
'get all tag names and tag text
Let acSubMemberAttrib = acBlockRef.GetAttributes
'loop through all tags in a block
For j = LBound(acSubMemberAttrib) To UBound (acSubMemberAttrib)
Select Case acSubMemberAttrib(j).TagString
Case "CABLE_NUMBER"
'adds new value
acSubMemberAttrib(j).TextString = "New Value"
Case "DESTIN_SYSN1"
'extract value from the tag
strSysName = acSubMemberAttrib(j).TextString
End select
'save changes to the drawing
acadDoc.Save
'close application
acadApp.Application.Quit
Set acadApp = Nothing
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.