Table of contents
Collapse the table of content
Expand the table of content

Document.ParseLine Method (Visio)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Parses a line of Microsoft Visual Basic code.


expression . ParseLine( Line )

expression A variable that represents a Document object.


NameRequired/OptionalData TypeDescription
LineRequiredStringA string interpreted as Visual Basic code.

Return Value



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.


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.

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" 
 MsgBox "Parse not successful" 
 End If 

End Sub
© 2018 Microsoft