Microsoft Office Tutorials and References
In Depth Information
Creating a Folder Tree Menu
aLevTwoEntries() = GetMenuEntries(LevTwoPath)¶
'Create buttons for the second level files¶
For j = LBound(aLevTwoEntries, 2) To UBound(aLevTwoEntries,
2)¶
If Len(aLevTwoEntries(0, j)) <> 0 Then¶
CreateMenuButton newPopup.CommandBar,
aLevTwoEntries(0, j), LevTwoPath¶
End If¶
Next j¶
'Now do any sub-folders at the second level¶
For j = LBound(aLevTwoEntries, 2) To UBound(aLevTwoEntries,
2)¶
If Len(aLevTwoEntries(1, j)) <> 0 Then¶
'Variable declaration¶
Dim newPopup2 As Office.CommandBarPopup¶
Set newPopup2 = CreateNewPopup(newPopup.CommandBar,
aLevTwoEntries(1, i), 1)¶
'Get the thirdlevel entries¶
'Variable declaration¶
Dim aLevThreeEntries() As String¶
Dim k As Long¶
aLevThreeEntries() = GetMenuEntries(LevTwoPath &
aLevTwoEntries(1, i) & "\")¶
'Only show files, for this level¶
For k = LBound(aLevThreeEntries, 2) To
UBound(aLevThreeEntries, 2)¶
If Len(aLevThreeEntries(0, k)) <> 0 Then¶
CreateMenuButton newPopup2.CommandBar,
aLevThreeEntries(0, k), LevTwoPath & aLevTwoEntries(1, j) & "\"¶
End If¶
Next k¶
End If¶
Next j¶
End If¶
Next i¶
End Sub¶
'Remove the entire menu, with all sub-entries¶
'by removing the top-level popup¶
Sub DeleteTree()¶
'Variable declaration¶
Dim cb As Office.CommandBar¶
CustomizationContext = NormalTemplate¶
Set cb = CommandBars(ToolbarTarget)¶
If buttonExists(cb, ButtonName) = True Then¶
cb.Controls(ButtonName).Delete¶
End If¶
End Sub¶
Wrd
Search JabSto ::




Custom Search