vba code to add text to Text Editor CE

Hi Folks,

In v8i I was able to automatically populate the text editor with desired text ready for a user to finish the input, but since upgrading to CE it will not work. It will work with place text above/below etc. but not in the text editor. The commands that do work do not allow the extra input before placement.

Is the function still available in CE with different syntax or has it been deleted.

I want to provide the user with a standard note to create consistency, but they need to add some information to the end of the standard note before it is placed.

I have tried the code below but it does not work in CE, but works in v8i ok.

     CadInputQueue.SendMessageToApplication "WORDPROC", "FirstLine " + sNote

Any help with this would be appreciated.

Regards,

John.

Parents
  • Hi John,

    at first, be aware this is not MicroStation programming forum, but general programming one, so your question will get less attention. I recommend to move the post to MicroStation Programming. To move existing post, use More > Move under your original post.

    Also, as usually, follow best practices and always specify product and version exactly (to use standard subject format is simple preferred way). There have been 15 versions of MicroStation CE released so far with different set of bugs and fixes.

    Is the function still available in CE with different syntax or has it been deleted.

    Technically it's not function ;-)

    It simulates internally sent commands, which is in this case the way how to interact with Text editor dialog, because there is no public interface like key-ins or VBA API, but it's not ensured it will work the same way in every version, because it's just internal implementation feature.

    A difference between V8i and CE is that WORDPROC application does not exists anymore in CE and text tools were moved to TEXTEDITOR.

    Any help with this would be appreciated.

    Using macro recording tool, this code seems work fine:

    Const fixed As String = "FirstLine "
    Dim suffix As String
    suffix = "whatever text"
    
    Dim keyin As String
    keyin = "TEXTEDITOR PLAYCOMMAND INSERT_TEXT " & fixed & suffix
    
    CadInputQueue.SendKeyin keyin

    With regards,

      Jan

  • Thanks Jan,

    Sorry for not stating the version etc, and placing it in this forum, I thought there was only one programming forum. BTW you link to MicroStation Programming Forum is to an archived forum, and I tried to move this but there was no other programming forums in the list.

    I am using MicroStation Update 13

    However, thank you for you help, I have managed to achieve a working as designed result.

    I finished up doing it as a Keyin as follows:

    place dialogtext above;TEXTEDITOR PLAYCOMMAND INSERT_TEXT CONTINUES ON DRG. No. 

    Thanks again Jan.

    Regards,

    John.

  • I thought there was only one programming forum

    There are plenty of them available :-)

    For unknown reason there is no "building programming", but other products (platform/MicroStation, civil, geospatial and also ProjectWise) have own dedicated programming communities.

    BTW you link to MicroStation Programming Forum is to an archived forum

    Oops, sorry. I tried it and it pointed to the forum list. Now it's corrected.

    and I tried to move this but there was no other programming forums in the list.

    The list is not important, it's not always complete. When there is not the desired forum available in the list, simply enter or paste the name and it should work. But it's true that the move tool is not very intuitive and friendly.

    With regards,

      Jan

Reply Children
No Data