PDA

View Full Version : Solved: Hide the Ribbon doesn't work on Startup form



dhutch75
10-16-2012, 08:43 AM
I'm attempting to hide the Ribbon in Access 2010 (Windows 7) when opening my app with the following code. I need to support legacy users with Access 2003 as well as Access 2010.


'**************************************************************
Private Sub Form_Load()
'**************************************************************
If SysCmd(acSysCmdAccessVer) > 11 Then 'Access 2003 = 11.0
docmd.showtoolbar "Ribbon", acToolbarNo
End If
End Sub


The code is associated with the Switchboard form that opens at Startup. This works properly when I manually open the form, but not when it opens automatically it by launching the app.

I've tried adding this code to the Open, Load, Resize, and Current events for the form, all with the same results.

Any ideas?

mrojas
12-17-2012, 07:57 AM
What happens if you leave the If statement out and you're running your app in 2010? Is the ribbon still visible?

dhutch75
12-17-2012, 06:39 PM
I actually solved this problem myself but forgot to close the thread. The solution was EXTREMELY obscure.

Background info:

I open this file programmatically from an external spreadsheet via VBA. The external file then prepopulates this file with data in 25-30 cells.
The action of writing this data from VBA causes the spreadsheet to flicker as it writes each cell entry. The screen updates also cause the write process to take considerably longer to run. To prevent these two undesirable effects, immediately after programmatically opening the workbook, I set Application.Visible = False. When all of the writes have finished, I set Application.Visible =True .
The workbook that I'm opening contains a query that automatically attempts to run when the file opens.
XL security settings prompt the user for permission to Enable/Disable the startup query.What I discovered:

The Enable/Disable prompt appears as soon as the first write to a cell occurs. (The security prompt does NOT happen when the spreadsheet first opens.)
If the workbook was NOT visible when security forced the visiblilty property to TRUE, the menus and toolbars remain hidden. Apparently, this security prompt restores visibility to the hidden workbook, but not to the hidden toolbars.The only way that I could keep toolbars visible was to set Application.Visible = True prior to the first write action.

... an interesting 'Feature' that took me a couple of days to identify!

Deborah