Document.ParseLine Method

Visio Automation Reference

Parses a line of Microsoft Visual Basic code.

Version Information
 Version Added:  Visio 4.5

Syntax

expression.ParseLine(Line)

expression   A variable that represents a Document object.

Parameters

Name Required/Optional Data Type Description
Line Required String A string interpreted as Visual Basic code.

Return Value
Nothing

Remarks

The ParseLine method tells the Microsoft Visual Basic for Applications (VBA) project of the Document object to parse the string passed to it as an argument.

The ParseLine method raises an exception if the string fails to parse.

Example

You can use the following procedure to determine whether a string has been successfully parsed. If the parse succeeds, the procedure displays a message box that announces the success; if the parse fails, it displays a message box that announces the failure.

Visual Basic for Applications
  

Public Sub ParseLine_Example()

Call LineParser("String to parse.")

End Sub

Public Sub LineParser(strString As String)

On Error Resume Next  
ThisDocument.ParseLine strString 
If Err = 0 Then 
    MsgBox "String parsed successfully" 
Else 
    MsgBox "Parse not successful" 
End If

End Sub

See Also