Hi All,
I'm making a custom ribbon for Access but when I start Access I get;
"...can't run the macro or callback function 'CallbackOnLoad'"
"...can't run the macro or callback function 'GetLink'"
"...can't run the macro or callback function 'GetText'"
Also, none of the buttons on the Ribbon work or have their updated names. I get errors such as;
"...can't run the macro or callback function 'PublicAction'"
Is there a reason nothing would be working, except for the Database Administration Tab? I can Compact and Repair Database and make a ACCDE, but nothing else on the ribbon seems to be working.
I think there is something simple I am missing, but I just can't see it and want to see if anyone here can help me out.
Here is the XML I'm using, followed by a sample of the VB.
If anything else is needed let me know and I will try and get it for you. Thanks.
I'm making a custom ribbon for Access but when I start Access I get;
"...can't run the macro or callback function 'CallbackOnLoad'"
"...can't run the macro or callback function 'GetLink'"
"...can't run the macro or callback function 'GetText'"
Also, none of the buttons on the Ribbon work or have their updated names. I get errors such as;
"...can't run the macro or callback function 'PublicAction'"
Is there a reason nothing would be working, except for the Database Administration Tab? I can Compact and Repair Database and make a ACCDE, but nothing else on the ribbon seems to be working.
I think there is something simple I am missing, but I just can't see it and want to see if anyone here can help me out.
Here is the XML I'm using, followed by a sample of the VB.
Code:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="CallbackOnLoad">
<commands>
<command idMso="FileNewDatabase" enabled="false"/>
<command idMso="FileCloseDatabase" enabled="false"/>
<command idMso="ApplicationOptionDialog" enabled="false"/>
<command idMso="FileOpenDatabase" enabled="false"/>
<command idMso="FileSaveAs" enabled="false"/>
<command idMso="FileSave" enabled="true"/>
<commands>
<ribbon startFromScratch="true">
<officeMenu>
<button idMso="ApplicationOptionsDialog" visible="false"/>
<splitButton idMso="FileSaveAsMenuAccess" visible="false"/>
<button idMso="FileSaveAs" visible="false"/>
<control idMso="Undo"/>
<control idMso="Redo"/>
<control idMso="Cut"/>
<control idMso="Copy"/>
<control idMso="Paste"/>
<button idMso=FileSave" visible="true"/>
<button idMso="FileCloseDatabase" visible="false"/>
<button idMso="FileNewDatabase" visible="false"/>
<button idMso="FileOpenDatabase" visible="false"/>
</officeMenu>
<tabs>
<tab idMso="TabCreate" visible="false"/>
<tab id="dbCustomTab" label="Main Menu" visible="true">
<group id="dbCustomGroup1" label="Device Management">
<separator id="separator12"/>
<button id="OpenSwitch" screentip="Open Switch Form" label="Switches"
imageMso="DiagramRadialInsertClassic" size="large" on Action="PublicAction"/>
<separator id="separator1" visible="false"/>
<button id="OpenVLANs" screentip="Open VLAN Form" label="VLANs"
imageMso="FileServerTransferDatabase" size="large" onAction="PublicAction"/>
<separator id="separator2" visible="false"/>
<box id="box1" boxStyle="horizontal">
<labelControl id="myLabel2" label=" IP or computer"/>
</box>
<box id="box2" boxStyle="horizontal">
<editBox id="PingBox" onChange="MyEditBoxCallbackOnChange" sizeString="wwwwwwwwww"/>
</box>
<box id="box16" boxStyle="horizontal">
<labelControl id="myLabel9" label=" "/>
<button id="Ping" screentip="Ping and switch or computer on the network" label="Ping"
imageMso="DiagramTargetInsertClassic" onAction="PublicAction"/>
</box>
<separator id="separator6"/>
<box id="box11" boxStyle="vertical">
</box>
<box id="box3" boxStyle="horizontal">
<labelControl id="myLabel4" label=" Device IP"/>
</box>
<box id="box4" boxStyle="horizontal">
<labelControl id="IPLabel" label="xxx.xxx."/>
<editBox id="SSHBox" onChange="MyEditBoxCallbackOnChange" sizeString="wwwww"/>
</box>
<box id="box12" boxStyle="horizontal">
<labelControl id="myLabel8" label=" "/>
<button id="SSH" screentip="SSH to any device on the network" label="SSH"
<imageMso="ServerConnection" onAction="PublicAction"/>
</box>
<separator id="separator13"/>
</group>
<group id="dbCustomGroup9" label="Custom Links">
<separator id="separator26"/>
<box id="box5" boxStyle="vertical">
<button id="Link1" imageMso="PivotGroupItems" getLabel="GetLink" onAction="MenuAction"/>
<button id="Link2" imageMso="PivotGroupItems" getLabel="GetLink" onAction="MenuAction"/>
<button id="Link3" imageMso="PivotGroupItems" getLabel="GetLink" onAction="MenuAction"/>
</box>
<separator id="separator7"/>
<box id="box6" boxStyle="vertical">
<button id="Link4" imageMso="PivotGroupItems" getLabel="GetLink" onAction="MenuAction"/>
<button id="Link5" imageMso="PivotGroupItems" getLabel="GetLink" onAction="MenuAction"/>
<button id="Link6" imageMso="PivotGroupItems" getLabel="GetLink" onAction="MenuAction"/>
</box>
<separator id="separator8"/>
<box id="box7" boxStyle="vertical">
<button id="Link7" imageMso="PivotGroupItems" getLabel="GetLink" onAction="MenuAction"/>
<button id="Link8" imageMso="PivotGroupItems" getLabel="GetLink" onAction="MenuAction"/>
<button id="Link9" imageMso="PivotGroupItems" getLabel="GetLink" onAction="MenuAction"/>
</box>
<separator id="separator25"/>
</group>
<group id=dbCustomGroup4" label="Search">
<separator id="separator14"/>
<box id="box8" boxStyle="horizontal">
<labelControl id="SearchLbl" label=" Keyword or Doc Type"/>
</box>
<box id="box9" boxStyle="horizontal">
<editBox id="MyEditBox" onChange="MyEditBoxCallbackOnChange" sizeString="wwwwwwwwwww"/>
</box>
<button id="Search" screentip="Search the Drive" label="Files"
imageMso="FileOpen" onAction="PublicAction"/>
<separator id="separator28"/>
<box id="box13" boxStyle="horizontal">
<labelControl id="NumLbl" label=" Phone Numbers"/>
</box>
<box id="box10" boxStyle="horizontal">
<editBox id=PhoneList" onChange="MyEditBoxCallbackOnChange" sizeString="wwwwwwwwwww"/>
</box>
<box id="box14" boxStyle="horizontal">
<button id="SearchPhone" screentip="Search for phone number" label="Numbers"
imageMso="AddressBook" onAction="PublicAction"/>
</box>
<separator id="separator15"/>
<box id="box25" boxStyle="vertical">
</box>
<box id="box24" boxStyle="horizontal">
<labelControl id="myLabel10" label=" Building #"/>
</box>
<box id="box23" boxStyle="horizontal">
<editBox id="BuildingBox" onChange="MyEditBoxCallbackOnChange" sizeString="wwwwwww"/>
</box>
<box id="box26" boxStyle="horizontal">
button id="Blg" screentip="Search for switch building" label="Switches"
imageMso="DatabaseRelationships" onAction="PublicAction"/>
</box>
<separator id="separator33"/>
</group>
<group id="dbCustomGroup8" label="Current User">
<separator id="separator23"/>
<box id="box20" boxStyle="horizontal">
<labelControl id="UserMark" label=" "/>
</box>
<box id="box21" boxStyle="horizontal">
editBox id="CurrentUser" enabled="false" getText="GetText" sizeString="wwwwwwwwwwwwwww"/>
</box>
<box id="box22" boxStyle="horizontal">
<button id="ChangeUser" screentip="Change user currently signed in" label="Change User"
imageMso="DatabasePermissionsMenu" onAction="PublicAction"/>
</box>
<separator id="separator24"/>
</group>
</tab>
<tab id="dbCustomTab4" label="Inventory" visible="true">
<group id="dbCustomGroup2" label="Inventory">
<button id="Computers" screentip="Open Computers Form" label="Computers"
imageMso="OutlookTaskCreate" size="large" onAction="PublicAction"/>
<button id="Switches" screentip="Open Switches Form" label="Switches"
imageMso="CreateReport" size="large" onAction="PublicAction"/>
</group>
</tab>
<tab id="CustomTab2" label="Database Administration" visible="true">
<group id="dbCustomGroup7" label="Maintenance">
<separator id="separator18"/>
<control idMso="FileCompactAndRepairDatabase" size="large" enabled="true"/>
<separator id="separator16"/>
<button id="BackupDB" screentip="Backup Database" label="Backup Database"
imageMso="FileBackupDatabase" size="large" onAction="PublicAction"/>
<separator id="separator17"/>
<control idMso="DatabaseMakeMdeFile" size="large" enabled="true"/>
<separator id="separator19"/>
</group>
<group id="dbCustomGroup5" label="Settings">
<button id="OpenDB" screentip="Open Database Administration Form"
imageMso="TableSharePointListsModifyColumnsAndSettings" size="large" onAction="PublicAction"/>
</group>
</tab>
<tab id="dbCustomTab3" label="Help" visible="true">
<group id="dbCustomGroup6" label="Help">
<separator id="separator20"/>
<button id="HelpGuide" screentip="Open Help Guide" label="Help Guide"
imageMso="Help" size="large" onAction="PublicAction"/>
<separator id="separator21"/>
<button id="About" screentip="Database Information" label="About"
imageMso="MacroSecurity" size="large" onAction="PublicAction"/>
<separator id="separator22"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Code:
Option Compare Database
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds as Long)
Public strPing, strSSH, strTxt, strPhone, strBlg As String
Public gobjRibbon As IRobbonUI
Public Sub PublicAction (control As IRibbonControl)
On Error GoTo ribbonerr
Select Case control.ID
Case "helpguide": Application.FollowHyperlink _
DBPath & "Help Guide.pdf"
Case "search":
If IsNull (strTxt) or strTxt = "" Then
MsgBox "Your search cannot be blank.", vbOKOnly, "Enter Item"
Exit Sub
End If
Forms!welcomefrm!SearchVar = strTxt
DoCmd.OpenForm "searchfrm", acNormal, , , , acWindowNormal
Case "Computers": DoCmd.OpenForm "computersfrm", acNormal, , , , acWindownNormal
If anything else is needed let me know and I will try and get it for you. Thanks.