![]() ![]() Spreadsheet, creates an AutoCAD drawing, places the text into the drawing,and then saves the drawing. ![]() Visual Basic Automation Sub Main() Dim xAP As Excel.Application Dim xWB As Excel.Workbook Dim xWS As Excel.Worksheet Set xAP = Excel.Application Set xWB = ("C:\A2K2_VBA\IUnknown.xls") Set xWS = xWB.Worksheets("Sheet1") MsgBox "Excel says: """ & Cells(1, 1) & """" Dim A2K As AcadApplication Dim A2Kdwg As AcadDocument Set A2K = CreateObject("AutoCAD.Application") Set A2Kdwg = MsgBox A2K.Name & " version " & A2K.Version & _ " is running." Dim Height As Double Dim P(0 To 2) As Double Dim TxtObj As AcadText Dim TxtStr As String Height = 1 P(0) = 1: P(1) = 1: P(2) = 0 TxtStr = Cells(1, 1) Set TxtObj = (TxtStr, _ P, Height) A2Kdwg.SaveAs "C:\A2K2_VBA\IUnknown.dwg" A2K.Quit Set A2K = Nothing xAP.Quit Set xAP = NothingEnd Sub Example 1-2 is a short butinteresting VB procedure that reads some text data from an Excel Example 1-2. Learn More Buy Creating a Drawing with Visual Basicīefore we complete our discussion of COM, let us see how VB and COM can beused to pass data from one application to another. VBA for AutoCAD 2002: Writing AutoCAD Macros ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |