abraxus Posted September 12, 2013 Posted September 12, 2013 I have found several guides for this, but they dont work what am i doing wrong? Sub test() Dim pt(2) As Double Dim objText As AcadText Dim aCol As AcadAcCmColor ' defines insertion point pt(0) = 0 pt(1) = 0 pt(2) = 0 ' creates the text object Set objText = ThisDrawing.ModelSpace.AddText("test", pt, 10) ' puts it on the right layer objText.Layer = "0" ' makes it the right color aCol = New AcadAcCmColor aCol.ColorMethod = acColorMethodByRGB aCol.ColorIndex = 4 objText.TrueColor = aCol End Sub when it reaches this line aCol = New AcadAcCmColor an exception is thrown saying %1 is not a valid Win32 application is it because i'm running the 64 bit version of autocad? if anyone knows of an easier way to change the color of an object please advise Quote
Tyke Posted September 13, 2013 Posted September 13, 2013 Try this ' make it the right color objText.Color = acCyan or this ' make it the right color objText.Color = 4 Both should work. Quote
abraxus Posted September 21, 2013 Author Posted September 21, 2013 Try this ' make it the right color objText.Color = acCyan or this ' make it the right color objText.Color = 4 Both should work. what version of autocad are you using? the AcadText object does not have a color attribute i am using 2012 Quote
Tyke Posted September 21, 2013 Posted September 21, 2013 what version of autocad are you using? the AcadText object does not have a color attribute i am using 2012 I'm using all versions from 2007 to 2014. All versions up to and including 2013 use VB6 whereas 2014 uses VB7. Just because the autocomplete function does not show a 'Color' property does not meanit does not have one, some properties for some methods are missing. Color for the text object is one. Just type in Color as shown in my pevious post andit will work. Your code with my altertin works forme in AutoCAD 2012. Quote
jmathew Posted October 7, 2023 Posted October 7, 2023 You must use: Set aCol = New AcadAcCmColor instead of aCol = New AcadAcCmColor Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.