Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to set the display name in the browser of parts and assemblies.
I got it working but parts with an empty ModelType it generates an error. Trying to elminate this with a Try and Catch statement returns an error "End of statement expected" in the line with "Try z1 = True"
'create reference to part oDoc = ThisApplication.ActiveDocument modelFileNamewithoutextension = IO.Path.GetFileNameWithoutExtension(ThisDoc.FileName) 'Set filename without file extension Dim x As Boolean = ThisDoc.FileName.Contains("FHE") 'Create variable of filename containing FHE Dim y As String = iProperties.Value("Project", "Part Number") 'Create variable from part number Dim y1 As Boolean = String.IsNullOrEmpty(y) 'Variable of empty part number Dim z As String = iProperties.Value("CUSTOM", "AIMD_ITEM_MODEL_TYPE") 'Create variable of AN/KEY Dim z1 As Boolean = String.IsNullOrEmpty(z) 'Variable of empty AN/KEY Try z1 = True 'Check if AN/KEY is empty Catch Return 'Exit from the rule End Try If x = False And y1 = False 'If filename does not contain FHE and part number is not empty oDoc.DisplayName = iProperties.Value("Project", "Part Number") & "/" & iProperties.Value("Project", "Revision Number") & " - " & iProperties.Value("Summary", "Title") & " - " & modelFileNamewithoutextension Else oDoc.DisplayName = z & "/" & iProperties.Value("Project", "Revision Number") & " - " & iProperties.Value("Summary", "Title") & " - " & modelFileNamewithoutextension End If iLogicVb.UpdateWhenDone = True
Does anyone know how to fix this?
Solved! Go to Solution.