Any help is greatly appreciated.

Code: Select all
Sub removeUnwantedToolbars(Event As Object)
Dim Doc As Object
Dim Frame As Object
Dim Layout As Object
Dim Element As Object
Dim I As Integer
Dim strURL As String
Dim Allowed
Dim CDA(4) As New com.sun.star.beans.PropertyValue
'Allowed=Array("private:resource/menubar/menubar","private:resource/toolbar/formsnavigationbar")
Doc=Event.Source.Parent.Parent
'xray doc
Frame=Doc.CurrentController.Frame
Layout=Frame.LayoutManager
For I=0 To UBound(Layout.Elements)
strURL=Layout.Elements(I).ResourceURL
'If Not isIN(strURL,Allowed) Then
Layout.hideElement(strURL)
'End If
Next I
End Sub