Group: microsoft.public.word.vba.general
From: "Summer"
Date: Friday, March 21, 2008 10:42 PM
Subject: Word 2007 Dynamic Menu include Folders?

Hello,

I've a dynamic menu on ribbon Word 2007 and it pulls .dot .dotx. dotm - this
however does now include subfolders or their contents in the WorkGroup Path
folder.

I'd like to create new dynamicmenu Code to read the same WorkGroups path but
select specific SubFolder's Contents? I'm not sure how to approach setting a
specific path to specific subfolder and its contents.

I'm at the dog paddle stage with this - so drowning is imminent! THANK YOU.


Sub rxdmnuTemplates_GetContent(control As IRibbonControl, ByRef content)
'Callback for GetContent to return XML used to create dynamicMenu

Dim objFSO As Object
Dim objTemplateFolder As Object
Dim file As Object
Dim sXML As String
Dim lBtnCount As Long

'Open the XML string
sXML = "

"http://schemas.microsoft.com/office/2006/01/customui"">"

'Create FSO object and set to templates folder
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTemplateFolder = _
objFSO.getfolder(Application.Options.DefaultFilePath(wdWorkgroupTemplatesPath))
'Add template files
If objTemplateFolder.Files.Count > 0 Then
For Each file In objTemplateFolder.Files
'Check if file is a temporary file
If Not Left(file.Name, 2) = "~$" Then
'File is not a temp file, so check extension
Select Case LCase(Right(file.Name, 4))
Case ".dot", "dotx", "dotm"
'Word template.
If Not LCase(Left(file.Name, 6)) = "normal" Then
sXML = sXML & _
"
"

'Feed the XML back to the Ribbon
content = sXML
End Sub


Safety Articles | Usenet Groups | Usenet News | Bluegrass