ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Removing the RECENTLY OPENED submenu item (https://www.excelbanter.com/excel-programming/277285-removing-recently-opened-submenu-item.html)

james

Removing the RECENTLY OPENED submenu item
 
Hello,

PLEASE HELP!! :confused:

I am trying to adjust the look of the menus in an xls workbook using
the following VBA script:-

With CommandBars("Worksheet Menu Bar").Controls("File")
.Controls("New...").Visible = False
.Controls("Open...").Visible = False
.Controls("Save As...").Visible = False
BLAH BLAH etc

However, I cannot remove the list of recently opened files because i do
not know what its 'name' is. I do know its ID is 831 but I am
struggling to write a VBA statement that likes using ID numbers instead
of names.

Any answers would be greatly appreciated.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Bernie Deitrick[_2_]

Removing the RECENTLY OPENED submenu item
 
James,

With Application
.DisplayRecentFiles = False
.RecentFiles.Maximum = 0
End With

HTH,
Bernie
Excel MVP


"james" wrote in message ...
Hello,

PLEASE HELP!! :confused:

I am trying to adjust the look of the menus in an xls workbook using
the following VBA script:-

With CommandBars("Worksheet Menu Bar").Controls("File")
Controls("New...").Visible = False
Controls("Open...").Visible = False
Controls("Save As...").Visible = False
BLAH BLAH etc

However, I cannot remove the list of recently opened files because i do
not know what its 'name' is. I do know its ID is 831 but I am
struggling to write a VBA statement that likes using ID numbers instead
of names.

Any answers would be greatly appreciated.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/




Frank Isaacs

Removing the RECENTLY OPENED submenu item
 
Sub ClearMenu()
Dim x As CommandBarControl

For Each x In CommandBars(1).Controls(1).Controls
If x.ID = 831 Then x.Visible = false
Next
End Sub

You'll probably want to use the names, as you did in your example code; I
got tired of retyping it in the immediate window before I actually wrote the
sub.

--
HTH -

-Frank
Microsoft Excel MVP
Dolphin Technology Corp.
http://vbapro.com






"james" wrote in message
...
Hello,

PLEASE HELP!! :confused:

I am trying to adjust the look of the menus in an xls workbook using
the following VBA script:-

With CommandBars("Worksheet Menu Bar").Controls("File")
Controls("New...").Visible = False
Controls("Open...").Visible = False
Controls("Save As...").Visible = False
BLAH BLAH etc

However, I cannot remove the list of recently opened files because i do
not know what its 'name' is. I do know its ID is 831 but I am
struggling to write a VBA statement that likes using ID numbers instead
of names.

Any answers would be greatly appreciated.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 11:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com