Sub ClearMRU()
'
' Macro created by
Graham Mayor to clear Word's recently used file list.
'
Updated 4 February 2006 and 6 July 2007
Dim sAssistant
As Boolean
Dim sMsg1 As String
Dim sMsg2 As String
Dim sMsg3 As String
Dim sMsg4 As String
Dim sVer As Integer
sMsg1 = "This will delete your
recently used file list"
sMsg2 = "OK, we won't do that then!"
sMsg4 = "Clear Recent File List"
sVer = Application.version
Application.DisplayRecentFiles =
True
listsize = RecentFiles.Maximum
sMsg3 = "Your recent file list has
been cleared and reset to hold " _
+ Str$(listsize) + " files."
If sVer < 12 Then 'Version is
not Word 2007
sAssistant = Assistant.Visible
'So use the Office Assistant
If sAssistant =
False Then
With
Assistant
.On = True
.Visible = True
End With
End If
Set Balloon = Assistant.NewBalloon
With Balloon
.Text =
sMsg1
.Button =
msoButtonSetOkCancel
.Animation = msoAnimationBeginSpeaking
ButtonPressed = .Show
End With
If ButtonPressed = -2
Then
Set
Balloon = Assistant.NewBalloon
With
Balloon
.Text = sMsg2
.Button = msoButtonSetOK
.Animation = msoAnimationGoodbye
.Show
End With
GoTo
skipped
End If
If ButtonPressed = -1
Then
RecentFiles.Maximum = 0
RecentFiles.Maximum = listsize
Set
Balloon = Assistant.NewBalloon
With
Balloon
.Text = sMsg3
.Button = msoButtonSetOK
.Animation = msoAnimationGetAttentionMinor
.Show
End With
End If
skipped:
Assistant.Visible = sAssistant
Else
'Word version is 2007
Response = MsgBox(sMsg1, vbOKCancel,
sMsg4)
If Response = 1
Then
RecentFiles.Maximum = 0
RecentFiles.Maximum = listsize
MsgBox sMsg3, vbInformation, sMsg4
Else
'User cancelled
MsgBox sMsg2, vbCritical, sMsg4
End If
End If
End Sub