Hi, on my pc i get the border zones but if i read the following posts then ther seems to be some bug.
Link1 Link2 Link3
It seems that you need to expand the border node in your browser befor you insert it. With those post i alterd the code i posted before but because i dont seem to have this bug i cant test it for you. there for i can only hope that this works. any way let me know.
Public Sub Main()
Dim bp = ThisApplication.ActiveDocument.BrowserPanes("DlHierarchy")
Dim borderTypes As String() = {"KAssembly", "KGang Assembly", "KGang Part", "KPart"}
Dim selectedBorderName As String
selectedBorderName = InputListBox("SELECT A BORDER TYPE", borderTypes, borderName, Title:="BORDER NAME", ListName:="List")
Dim doc As DrawingDocument = ThisApplication.ActiveDocument
For Each border As BorderDefinition In doc.BorderDefinitions
If (border.Name.Equals(selectedBorderName, StringComparison.CurrentCultureIgnoreCase)) Then
Dim borderNode As BrowserNode = FindBorderNode(border.Name, bp.TopNode.BrowserNodes)
borderNode.EnsureVisible()
doc.ActiveSheet.Border.Delete()
doc.ActiveSheet.AddBorder(border)
End If
Next
Dim selectedTitleBlockName As String = ""
Select Case selectedBorderName
Case "KAssembly"
selectedTitleBlockName = "Kinze Assembly"
Case "KGang Assembly"
selectedTitleBlockName = "Kinze Gang Assembly"
Case "KGang Part"
selectedTitleBlockName = "Kinze Gang"
Case "KPart"
selectedTitleBlockName = "Kinze Part"
End Select
For Each titleblock As TitleBlockDefinition In doc.TitleBlockDefinitions
If (titleblock.Name.Equals(selectedTitleBlockName, StringComparison.CurrentCultureIgnoreCase)) Then
doc.ActiveSheet.TitleBlock.Delete()
doc.ActiveSheet.AddTitleBlock(titleblock)
End If
Next
End Sub
Function FindBorderNode(name As String, nodes As BrowserNodesEnumerator) As BrowserNode
Dim foundNode As BrowserNode = Nothing
For Each node In nodes
If name = node.BrowserNodeDefinition.Label Then
foundNode = node
Exit For
End If
foundNode = FindBorderNode(name, node.BrowserNodes)
If Not foundNode Is Nothing Then
Exit For
End If
Next
Return foundNode
End Function
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog: hjalte.nl - github.com