| Author |
Message |
peterpeter
Joined: 29 Jul 2005
Posts: 7
|
Posted:
Sat Jul 22, 2006 1:48 pm Post subject:
Setting the width factor of a acadtext object with VBA |
|
|
Hallo AutoCad Goeroes,
Does anyone know how to set the width factor of a text object via VBA.
When I look to the property's of the text object I can't find a property to control the width.
Thank you
Peter Van der velden
|
|
| Back to top |
|
 |
Fatty
Joined: 08 Jun 2006
Posts: 8
Location: Sankt-Petersburg, Russia
|
Posted:
Sat Jul 22, 2006 8:31 pm Post subject:
Re: Setting the width factor of a acadtext object with VBA |
|
|
| peterpeter wrote: | Hallo AutoCad Goeroes,
Does anyone know how to set the width factor of a text object via VBA.
When I look to the property's of the text object I can't find a property to control the width.
Thank you
Peter Van der velden |
Hi Peter,
see how this will work for you:
| Code: | Sub Ch_ScaleFactorExample()
Dim pickObj As AcadEntity
Dim varPt As Variant
Dim sclFac As Double
On Error GoTo error_trapp
ThisDrawing.Utility.GetEntity pickObj, varPt, "Select text:"
If TypeOf pickObj Is AcadText Then
sclFac = InputBox("Enter new scale factor for the text", _
"Change Scale Factor", 1) ' by default 1
pickObj.ScaleFactor = sclFac
pickObj.Update
Else
MsgBox "This is not a text object"
End If
error_trapp:
MsgBox Err.Number & Err.Description
End Sub |
~'J'~ |
|
| Back to top |
|
 |
peterpeter
Joined: 29 Jul 2005
Posts: 7
|
Posted:
Sun Jul 23, 2006 2:02 pm Post subject:
Re: Setting the width factor of a acadtext object with VBA |
|
|
| Fatty wrote: | | peterpeter wrote: | Hallo AutoCad Goeroes,
Does anyone know how to set the width factor of a text object via VBA.
When I look to the property's of the text object I can't find a property to control the width.
Thank you
Peter Van der velden |
Hi Peter,
see how this will work for you:
| Code: | Sub Ch_ScaleFactorExample()
Dim pickObj As AcadEntity
Dim varPt As Variant
Dim sclFac As Double
On Error GoTo error_trapp
ThisDrawing.Utility.GetEntity pickObj, varPt, "Select text:"
If TypeOf pickObj Is AcadText Then
sclFac = InputBox("Enter new scale factor for the text", _
"Change Scale Factor", 1) ' by default 1
pickObj.ScaleFactor = sclFac
pickObj.Update
Else
MsgBox "This is not a text object"
End If
error_trapp:
MsgBox Err.Number & Err.Description
End Sub |
~'J'~ |
Hello Fatty,
I have tried your code and it works perfect.
I thought that the .scalefactor property would scale the object in the X and Y dimentions.
Thank You very much for the help and the quick reply
Peter
|
|
| Back to top |
|
 |
Fatty
Joined: 08 Jun 2006
Posts: 8
Location: Sankt-Petersburg, Russia
|
Posted:
Sun Jul 23, 2006 7:58 pm Post subject:
|
|
|
Hi Peter
Glad to help
Cheers
~'J'~ |
|
| Back to top |
|
 |
|
|
|
|