Any ACAD VBA guys here?
here is my code:
' ---------------------------------------
' insert into AutoCAD
Dim objAcadApp As AcadApplication
Dim ThisDrawing As AcadDocument
Set objAcadApp = GetObject(, "AutoCAD.Application"
objAcadApp.Visible = True
Set ThisDrawing = objAcadApp.ActiveDocument
Dim textObj As AcadText
Dim textString As String
Dim insertionPoint(0 To 2) As Double
Dim height As Double
Dim newTextStyle As AcadTextStyle
Dim currTextStyle As AcadTextStyle
Set currTextStyle = ThisDrawing.ActiveTextStyle
Set newTextStyle = ThisDrawing.TextStyles.Add("Code128"
ThisDrawing.ActiveTextStyle = newTextStyle
' Define the text object
textString = Me!Text2
insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
height = 0.5
ThisDrawing.Regen acActiveViewport
' Create the text object in model space
Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
'finished set test style back
ThisDrawing.ActiveTextStyle = currTextStyle
--------------------------
This code creates a text entty but does not use the barcode style. How do I load the style in VBA?
I need to load a barcode font I created using VBA.
DougP, MCP
here is my code:
' ---------------------------------------
' insert into AutoCAD
Dim objAcadApp As AcadApplication
Dim ThisDrawing As AcadDocument
Set objAcadApp = GetObject(, "AutoCAD.Application"
objAcadApp.Visible = True
Set ThisDrawing = objAcadApp.ActiveDocument
Dim textObj As AcadText
Dim textString As String
Dim insertionPoint(0 To 2) As Double
Dim height As Double
Dim newTextStyle As AcadTextStyle
Dim currTextStyle As AcadTextStyle
Set currTextStyle = ThisDrawing.ActiveTextStyle
Set newTextStyle = ThisDrawing.TextStyles.Add("Code128"
ThisDrawing.ActiveTextStyle = newTextStyle
' Define the text object
textString = Me!Text2
insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
height = 0.5
ThisDrawing.Regen acActiveViewport
' Create the text object in model space
Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
'finished set test style back
ThisDrawing.ActiveTextStyle = currTextStyle
--------------------------
This code creates a text entty but does not use the barcode style. How do I load the style in VBA?
I need to load a barcode font I created using VBA.
DougP, MCP