Place Text through VBA

Hi all,

Trying to work out how to place a predefined text string onto the drawing, without bring up any menus or options.

Have tried

    CadInputQueue.SendKeyin "place text"
CadInputQueue.SendKeyin sText

But the keyin window appears and i cant work out how to close it.

Also have tried
    CadInputQueue.SendKeyin "place dialogtext icon"
CadInputQueue.SendMessageToApplication "WORDPROC", sText

Which brings up the word processor but doesn't input the text.

Ideally i'd like to simple click a button on a form and the text appears on the drawing at the cursor ready for the user to select the location.

Cheers,

Rob

Parents
  • Unknown said:
    CadInputQueue.SendKeyin "place text"
    CadInputQueue.SendKeyin sText

    In general, if you queue a user key-in using VBA then the result is the same as if you performed that task manually.  In other words, MicroStation can't distinguish between you typing place dialogtext icon and VBA queueing place dialogtext icon.

    If a key-in causes MicroStation to pop a dialog, then it will pop that dialog.

    If you want to avoid the consequents of a user key-in, then use VBA to create objects directly, in the way that others have suggested.  Search VBA help for examples.  Searching for CreateTextElement1 reveals an example under topic Elements and Levels.

     
    Regards, Jon Summers
    LA Solutions

    Answer Verified By: Rob Golding 

Reply
  • Unknown said:
    CadInputQueue.SendKeyin "place text"
    CadInputQueue.SendKeyin sText

    In general, if you queue a user key-in using VBA then the result is the same as if you performed that task manually.  In other words, MicroStation can't distinguish between you typing place dialogtext icon and VBA queueing place dialogtext icon.

    If a key-in causes MicroStation to pop a dialog, then it will pop that dialog.

    If you want to avoid the consequents of a user key-in, then use VBA to create objects directly, in the way that others have suggested.  Search VBA help for examples.  Searching for CreateTextElement1 reveals an example under topic Elements and Levels.

     
    Regards, Jon Summers
    LA Solutions

    Answer Verified By: Rob Golding 

Children