Autoexec runs first so I don't think you can.
Perhaps use a startup form instead with the autoexec code in the form load event....?
remove the ribbon name from access Option.
on autoexec add a code that will run a Function that will load your ribbon.
after calling the function from the macro, run other part of the macro.
see this link on manually loading the ribbon.
https://docs.microsoft.com/en-us/office/vba/api/Access.Application.LoadCustomUI
' --- Load the Ribbon
strRibbonName = "Ribbon_NoamLekochot"
strRibbonXML = DLookup("[RibbonXml]", "USysRibbons", "[RibbonName] = '" & strRibbonName & "' ")
Application.LoadCustomUI strRibbonName, strRibbonXML
Thanks
The same idea I had.
Hoped there is another solution
Is there any perticular reason you're looking for another solution?
The sample database at the bottom of this post may help.
https://www.access-programmers.co.uk/forums/showthread.php?t=306197
https://www.access-programmers.co.uk/forums/attachment.php?attachmentid=75903&d=1565334844
Is there any particular reason you're looking for another solution?
The sample database at the bottom of this post may help.
https://www.access-programmers.co.uk/forums/showthread.php?t=306197
Public objRibbonName As IRibbonUI
Public Sub Ribbon_OnLoad(ribbon As IRibbonUI)
Set objRibbonName = ribbon
objRibbonName.Invalidate
....
This didn't work eitherAutoexec runs first so I don't think you can.
Perhaps use a startup form instead with the autoexec code in the form load event....?
I tried your suggestionI didn’t recommend LoadCustomUI as it’s never worked for me.
However the method I suggested is used in several of my apps and does work for me. I have the ribbon loaded in Access options.
If you are still using a function called autoexec I suggest you rename it to avoid confusing Access
EDIT BTW the startup form can be hidden if you wish
Public Sub Ribbon_OnLoad(ribbon As IRibbonUI)
Set objRibbonName = ribbon
objRibbonName.Invalidate
[COLOR="Blue"]DoCmd.OpenForm "frmName"[/COLOR]
so you need to load the ribbon first before the login?
remove the opening of the from from autoexec macro.
put it on the OnLoad event of the ribbon:
Code:Public Sub Ribbon_OnLoad(ribbon As IRibbonUI) Set objRibbonName = ribbon objRibbonName.Invalidate [COLOR="Blue"]DoCmd.OpenForm "frmName"[/COLOR]
I tried your suggestion
Ribbon won't show once I load a MsgBox or a PopUp Modale form either from the OnLoadEvent or the OnOpen code of this Hidden frmAutoExec form
no, what does autoexec do?
if you can move all the code to ribbon_onload, why not.
1. yes, the Ribbon is in the Access' optionsOK now it makes sense.
Do you have to include both of those at startup?
If you must have both of those then I suggest you add a timer event to the hidden startup form to delay each of those by say 1 second to give the ribbon time to load. Once the timer event is triggered, reset the timer interval to zero so it is disabled.
Just to clarify
1. You do have the custom ribbon loaded in Access options?
2. You no longer have an autoexec macro?
before i gave the code i tested it on mine
and it works.