Please convert and give me VBA to C#
Function sGetDocVar(ByVal sVName As String) As String
On Error GoTo sGetDocVar_ERROR
sGetDocVar = ActiveDocument.Variables(sVName).Value
Exit Function
sGetDocVar_ERROR:
Select Case Err.Number
Case 5825 'Variable does not exist
sGetDocVar = vbNullString
Case Else
Const sProcedure As String = "sGetDocVar"
End Select
End Function

chetan AllipurPosted Jun 23, 2017, 12:34 AM
Abhilash J APosted Jun 22, 2017, 1:26 PM
Case Elsesupposed to do? at the moment it does nothing. That procedure returns "" on any error thrown byActiveDocument.Variables()so in C# you would just try {} it.Rajkiran SwainPosted Jun 22, 2017, 12:33 PM