Jump to content

Justifying text in VBA


Tyke

Recommended Posts

Hi,

 

I am having a problem justifying text that I create in a VBA routine. When I use this code:

 

If ThisDrawing.ActiveSpace = acModelSpace Then
   Set txtPNum = ThisDrawing.ModelSpace.AddText(strPNum, varPNumIns, dblTHeight)
Else
   Set txtPNum = ThisDrawing.PaperSpace.AddText(strPNum, varPNumIns, dblTHeight)
End If

txtPNum.Alignment = acAlignmentRight
txtPNum.Update

 

The text is inserted at 0,0,0

If I comment out the alignment line the text is inserted in the expected position.

 

I also have some MText that I insert and I can't seem to find a method to set its alignment. In the AutoCAD Properties window there is an alignment property. :-(

 

Has anyone else encounted these problems and does anyone see what I'm doing wrong?

Link to comment
Share on other sites

Dave,

That works a treat for the text. Any ideas on the MText, it's not that important, but it's just bugging me.

 

Many thanks.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...