MicroStation Connect update 16 - VBA
I am writing a tool that will send information to the Message Center in MicroStation. I understand how to return or continue a line of code in the VBA editor to shorten the line but for the Message Center, I do not understand how to do this for the message details. I need to continue the details on the next line in the code to keep it clean and not run off the page in the VBA editor. Does anyone know how to do this?
Here is an example of what it is doing and I need everything after the !! ATTENTION !! in the details portion with sentence 2 being on the next line in the code itself.
ShowMessage "!! ATTENTION !! ATTENTION !! Click here for more details", "This is an example message sentence 1. Sentence 2 should be on the next line.", _ msdMessageCenterPriorityWarning
Hi Mark,
please be aware this is general Developer and Programming Forum, whereas your question is about MicroStation programming. I recommend to move the discussion to MicroStation Programming forum. To move existing discussion to another forum, use More > Move tool, available under your original post.
Also, please follow programming the best practices: E.g. standardized subject format helps to identify used product, version and language without opening and reading the post itself, which allow to quickly identify questions areas.
Mark Winegar said:Here is an example of what it is doing
Sorry, it is not the example at all. What method is ShowMessage? It does not exist in MicroStation VBA API. Using what object / class you show your message?
Do you mean you use MessageCenter.AddMessage method, where you pass arguments "!! ATTENTION !! ATTENTION !! Click here for more details", "This is an example message sentence 1. Sentence 2 should be on the next line." and msdMessageCenterPriorityWarning?
"!! ATTENTION !! ATTENTION !! Click here for more details"
"This is an example message sentence 1. Sentence 2 should be on the next line."
msdMessageCenterPriorityWarning
Please share code that makes sense and do not lead to further questions!
Mark Winegar said:I need to continue the details on the next line in the code to keep it clean and not run off the page in the VBA editor. Does anyone know how to do this?
This is general VBA question, not specifically MicroStation VBA or MessageCenter interaction, so you can find plenty of relevant discussions.
The final code is simple:
Dim msg As String msg = "This is message" Dim details As String details = "This is first line" & vbCrLf & "This is second line" MessageCenter.AddMessage msg, details, msdMessageCenterPriorityWarning
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Jan Šlegr said:What method is ShowMessage? It does not exist in MicroStation VBA API
Sure it exists: try it! Here's some more info. I use ShowMessage constantly, because it provides a one-line route to the Message Center.
ShowMessage
Regards, Jon Summers LA Solutions