I have the following code for an access form. It seems that SendKeys messing with my NumLock key, toggling it when I open and close the form.
For legitimate reasons that I donβt want to go into, I really donβt want to hide the feed completely (I want the dropdown menus to still be available), so the DoCmd.ShowToolbar command DoCmd.ShowToolbar not my preferred way of doing this.
Does anyone have any suggestions as to how I can modify the code below to accomplish what I want using the SendKeys command?
Using Access 2007, the command
CommandBars.ExecuteMso "MinimizeRibbon"
unavailable to me.
By the way, the database will be distributed, so the solution should be contained in the database.
Private Sub Form_Close() ' Unhide navigation pane DoCmd.NavigateTo "acNavigationCategoryObjectType" DoCmd.Maximize ' Maximize the ribbon RibbonState = (CommandBars("Ribbon").Controls(1).Height < 75) Select Case RibbonState Case True SendKeys "^{F1}", True Case False 'Do nothing, already maximized End Select End Sub Private Sub Form_Load() ' Hide navigation pane DoCmd.NavigateTo "acNavigationCategoryObjectType" DoCmd.Minimize Debug.Print Application.CommandBars.Item("Ribbon").Height ' Minimize ribbon RibbonState = (CommandBars("Ribbon").Controls(1).Height < 100) Select Case RibbonState Case True 'Do nothing, already minimized Case False SendKeys "^{F1}", False End Select End Sub
vba access-vba ms-access-2007 sendkeys
user12059
source share