This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

How to Split a VBScript Statement Across Multiple Lines in DIAdem

Updated Dec 9, 2022

Reported In

Software

  • DIAdem Full

Issue Details

I am writing a script in DIAdem and one of my statements is very long. I want to be able to split the statement in several lines so it will be easier to read. I tried to break the statement with ENTER, but it does not work since VBScript takes the ENTER as the end of statement character.  How can I put my statement on multiple lines?

Solution

In VBScript you can use an underscore to signal that a statement will continue on the next line. For example:

MsgBox "This is a message"

Can be replaced by:

MsgBox _
"This is a message"


If the line break occurs in the middle of a string you can use the concatenation character & to append the string together so it will still appear on one line. For example: 

MsgBox "This is a really long message"

Can be replaced by: 

MsgBox "This is a" &_
"really long message"