Disabling PowerPoint Recent Files list

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm automating PowerPoint (Office 2000) from another VB application and can't
seem to disable the Recent Files list. I have tried calling
<CommandBarButton>.Enabled = false and also <CommandBarButton>.Delete and in
both cases the error message I get is:
Method 'Enabled' of object '_CommandBarButton' failed
Method 'Delete' of object '_CommandBarButton' failed

Has anyone been able to successfully do this in any version of PowerPoint?

Thanks, Marianne
 
Stumpiana said:
I'm automating PowerPoint (Office 2000) from another VB application and can't
seem to disable the Recent Files list. I have tried calling
<CommandBarButton>.Enabled = false and also <CommandBarButton>.Delete and in
both cases the error message I get is:
Method 'Enabled' of object '_CommandBarButton' failed
Method 'Delete' of object '_CommandBarButton' failed

Has anyone been able to successfully do this in any version of PowerPoint?

I'm not sure anyone's showed up with a reason to do this. ;-)

Post a bit of the actual code you're using, perhaps.

And more important, removing the recent files list is a perceived solution.
What's the problem?
 
Would it be acceptable just to fill the recently used file list with
fictious entries?
**Fill the MRU (Most Recently Used) list with bogus file names
http://www.rdpslides.com/pptfaq/FAQ00373.htm

Can we assume that you do not want the name/path of the automated
presentation to be available from the file pulldown list?

--
Bill Dilworth
Microsoft PPT MVP Team
Users helping fellow users.
===============
Please spend a few minutes checking vestprog2@
out www.pptfaq.com This link will yahoo.
answer most of our questions, before com
you think to ask them.

Change org to com to defuse anti-spam,
ant-virus, anti-nuisance misdirection.
..
..
 
I'm automating PowerPoint from an application in which we control the File
open, save, saveas, close and only allow 1 file (or workbook) to be open at a
time. If the user is allowed to select anything in the Recent files list,
another workbook gets opened in the application and I'm trying to prevent
this. Here is some code I'm using to disable the Open, Save, etc., along
with the code that doesn't work for the recent files:

Private Sub CustomPptObject(objPpt As PowerPoint.Application, _
Optional BlnSaveEnabled As Boolean = True, _
Optional intResultCode As Integer = gconstOK)

'Customize the powerpoint object to be display inside the DocContainer.
On Error GoTo CustomPptObjectErr

'Dim objRecentFile As Word.RecentFile

'disable certain File menu options
With objPpt.CommandBars("Menu Bar")
.Controls("&File").Controls("&New...").Enabled = False
.Controls("&File").Controls("&Open...").Enabled = False
.Controls("&File").Controls("&Close").Enabled = False
.Controls("&File").Controls("&Exit").Enabled = False
.Controls("&File").Controls("Save &As...").Enabled = False
.Controls("&File").Controls("Save").Enabled = BlnSaveEnabled
' PowerPoint 2000 or greater
If mstrOfficeVersion = OFFICE_2000 Then
.Controls("&File").Controls("Save as Web Pa&ge...").Enabled = False
End If
End With

'disable the standard toolbar.
'"New &Blank Document"
With objPpt.CommandBars("Standard")
.Controls(1).Enabled = False
'&Open...
.Controls(2).Enabled = False
'&Save
.Controls(3).Enabled = BlnSaveEnabled
End With

'remove the recentFile list
'Search for menu items starting with "&1...", "&2...", etc.
Dim I As Integer
Dim J As Integer
Dim StartIdx As Integer
Dim EndIdx As Integer
Dim Pos As Integer
Dim CmdBarButton As Office.CommandBarButton
StartIdx = 0
EndIdx = 0
With objPpt.CommandBars("Menu Bar").Controls("&File")
For I = 1 To .Controls.Count
OutputDebugString .Controls(I).Caption
Pos = InStr(.Controls(I).Caption, "&1")
If Pos = 1 Then
'match found for first recent file
StartIdx = I
End If
Pos = InStr(.Controls(I).Caption, "&Recent")
If Pos = 1 Then
EndIdx = I
Exit For
End If
Next
On Error Resume Next
If StartIdx > 0 And EndIdx >= StartIdx Then
'Disable these menu items
For J = StartIdx To EndIdx
'TBD: None of these work!
Set CmdBarButton = .Controls(J)
CmdBarButton.Visible = False
If Err.Number <> 0 Then OutputDebugString Err.Description & vbCrLf
CmdBarButton.Enabled = False
If Err.Number <> 0 Then OutputDebugString Err.Description & vbCrLf
CmdBarButton.Delete
If Err.Number <> 0 Then OutputDebugString Err.Description & vbCrLf
Next
End If
End With

Exit Sub

CustomPptObjectErr:

On Error Resume Next
OutputDebugString "Error in CustomPptObject: " & Err.Description & vbCrLf

End Sub
 
Stumpiana said:
I'm automating PowerPoint from an application in which we control the File
open, save, saveas, close and only allow 1 file (or workbook) to be open at a
time. If the user is allowed to select anything in the Recent files list,
another workbook gets opened in the application and I'm trying to prevent
this.

Can you install a PPT addin? If so it might be a lot simpler to trap the
presentation open event, test for the number of open presentations and if it's
greater than 1, close the just-opened presentation.

But note that if you do Tools, Options, General tab and remove the check next to
"Recently opened files", the MRU list goes away.

Looks like you can set this in the registry ...

HKCU\Software\Microsoft\Office\x.x\PowerPoint\Options

MRUListActive = 0 to disable the list

You'd have to set this while PPT isn't running.

Here is some code I'm using to disable the Open, Save, etc., along
 
Thank you so much! The registry key was exactly what I needed!
Stumpiana
 
Now that I can automate PowerPoint in Office 2003, with your help getting the
window handle, I see that the Recent Files list is not disabled. It looks
like with Office 2003 (and maybe 2002?) the MRUListActive registry entry is
not there. Is there a different way to disable the RecentFiles list in
PowerPoint 2003 (and 2002)?
 
Please disregard this question. All I needed to do was create a
MRUListActive registry key myself and the recent files list was still
disabled. Sorry.
 
Stumpiana said:
Now that I can automate PowerPoint in Office 2003, with your help getting the
window handle, I see that the Recent Files list is not disabled. It looks
like with Office 2003 (and maybe 2002?) the MRUListActive registry entry is
not there. Is there a different way to disable the RecentFiles list in
PowerPoint 2003 (and 2002)?

Seems to be here in PPT2003:

HKCU\Software\Microsoft\Office\11.0\PowerPoint\Options

MRUListActive as Reg_DWORD = 1 or 0

You can watch it change in Regedit when you change the setting in PPT.

You can't change it in the registry and expect PPT to follow, though. It
doesn't work that way.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top