我在通过网络共享的Microsoft Access DB中设置了自定义功能区。当一个用户登录时,OnRibbonLoad会起作用,但是,即使另一个用户从同一台计算机登录,它也无法正常工作。
我更改了数据库中第二个用户的安全权限以匹配第一个用户,但除此之外,我什至不知道从哪里开始。
VBA
Option Compare Database
Option Explicit
Public globalRibbon As IRibbonUI
Public Sub onRibbonLoad(ByVal ribbon As IRibbonUI)
Set globalRibbon = ribbon
End Sub
Public Sub GetImageCallBack(control As IRibbonControl, ByRef image)
Dim strPath As String
strPath = CurrentProject.Path & "\DbImages\"
Select Case control.ID
Case "appIcon"
Set image = LoadPicture(strPath & "test4.bmp")
End Select
End Sub
Public Sub GetUserNameRibbon(control As IRibbonControl, ByRef Label)
Label = "User: " & Environ("Username")
End Sub
XML
<?xml version="1.0" encoding="utf-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
onLoad="OnRibbonLoad">
<ribbon startFromScratch="true">
<tabs>
<tab id="Home" label="Home">
<group id ="Application" label="Application">
<button id="AppIcon" getImage="GetImageCallBack" size="large"/>
<labelControl id="UserID" getLabel="GetUserNameRibbon"/>
</group>
<group id="Group1" label="Control">
<button id="Primary" label="Primary" imageMso="BlogHomePage"
tag="Primary" onAction="ribOpenForm" getEnabled="ControlEnabled"
size="large" supertip="Open the Main Menu"/>
</group>
</tab>
</tabs>
</ribbon>