A
avkokin
Hello. Thank's all for your answers. But I unknow how to open the
files from list which I create into my item menu.
This is the code with help it I created new item menu into menu bar
with the list of recent files. Now how to open they?
Sub newItemMenuBar()
'create new item menu "MRUF" into menu bar
Dim rf As RecentFile
Dim oPopup As CommandBarPopup
Dim oBtn As CommandBarButton
Dim i As Long
On Error Resume Next
Set oPopup = CommandBars.FindControl(Tag:="rf")
If Not oPopup Is Nothing Then
oPopup.Delete
End If
Set oPopup =
CommandBars.ActiveMenuBar.Controls.Add(Type:=msoControlPopup,
Before:=1)
With oPopup
.Caption = "MRUF"
.BeginGroup = True
.Tag = "rf"
End With
If RecentFiles.Count >= 1 Then
For Each rf In RecentFiles
If Len(Dir(rf.Path & "\" & rf.Name)) = 0 Then
RecentFiles(rf.Index).Delete
End If
Next rf
Set rf = Nothing
For i = 1 To RecentFiles.Count
Set oBtn = oPopup.Controls.Add(msoControlButton)
With oBtn
.Caption = Application.RecentFiles(i).Name
.Style = msoButtonCaption
.OnAction = "openRF"
End With
Next i
End If
Set oPopup = Nothing
Set oBtn = Nothing
End Sub
Sub openRF()
????
End Sub
Thank you very much.
files from list which I create into my item menu.
This is the code with help it I created new item menu into menu bar
with the list of recent files. Now how to open they?
Sub newItemMenuBar()
'create new item menu "MRUF" into menu bar
Dim rf As RecentFile
Dim oPopup As CommandBarPopup
Dim oBtn As CommandBarButton
Dim i As Long
On Error Resume Next
Set oPopup = CommandBars.FindControl(Tag:="rf")
If Not oPopup Is Nothing Then
oPopup.Delete
End If
Set oPopup =
CommandBars.ActiveMenuBar.Controls.Add(Type:=msoControlPopup,
Before:=1)
With oPopup
.Caption = "MRUF"
.BeginGroup = True
.Tag = "rf"
End With
If RecentFiles.Count >= 1 Then
For Each rf In RecentFiles
If Len(Dir(rf.Path & "\" & rf.Name)) = 0 Then
RecentFiles(rf.Index).Delete
End If
Next rf
Set rf = Nothing
For i = 1 To RecentFiles.Count
Set oBtn = oPopup.Controls.Add(msoControlButton)
With oBtn
.Caption = Application.RecentFiles(i).Name
.Style = msoButtonCaption
.OnAction = "openRF"
End With
Next i
End If
Set oPopup = Nothing
Set oBtn = Nothing
End Sub
Sub openRF()
????
End Sub
Thank you very much.