VBA - Reference issue MSO.DLL -> VBEUI.DLL

Mellonio

New member
Local time
, 00:04
Joined
Mar 17, 2022
Messages
4
I create an application in Access 2010 (accde).
The application runs on different machines from Access 2010,... 2019 and 365

I have encountered problems in some configurations where the reference:

(same Microsoft Office 2016 version)

first computer:
name: Office
-------------------------------------------------
{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}
'C:\Program Files\Common Files\Microsoft Shared\OFFICE16\MSO.DLL'

is changed to

second computer:
name: Office
-------------------------------------------------
{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}
C:\PROGRA~1\COMMON~1\MICROS~1\VBA\VBA7.1\VBEUI.DLL

Program aborts (Error 3075: Function not available in expressions ... UCASE(..
The error does not appear with reference mso.dll

any suggestions? Thanks
 
Last edited:
Set them to be the same, as the correct one.

Here is something I used (albeit in Excel) with the same problem.

Code:
Option Explicit

Sub xlfVBEListReferences()
' Requires References :: Microsoft Visual Basic for Applications Extensibility 5.3
'                        C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB
Dim oRef As VBIDE.Reference   ' Item
Dim oRefs As VBIDE.References ' Collection
Dim i As Integer

Set oRefs = Application.VBE.ActiveVBProject.References

    Debug.Print "Print Time: " & Time & " :: Item - Name and Description"
        For Each oRef In oRefs
            i = i + 1
            Debug.Print "Item " & i, oRef.Name, oRef.Description, oRef.Major, oRef.Minor
        Next oRef
    Debug.Print vbNewLine

    i = 0
    Debug.Print "Print Time: " & Time & " :: Item - Full Path"
        For Each oRef In oRefs
            i = i + 1
            Debug.Print "Item " & i, oRef.FullPath
        Next oRef
    Debug.Print vbNewLine

    i = 0
    ' List the Globally Unique Identifier (GUID) for each library referenced in the current project
    Debug.Print "Print Time: " & Time & " :: Item - GUID"
        For Each oRef In oRefs
            i = i + 1
            Debug.Print "Item " & i, oRef.GUID
        Next oRef
    Debug.Print vbNewLine

End Sub
Sub xlfVBEAddReferences()
Dim oRefs As References
Set oRefs = Application.VBE.ActiveVBProject.References

    On Error GoTo OnError
    oRefs.AddFromFile "C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE12\MSO.DLL"

OnError:
End Sub
Sub xlfVBEAddReferencesGUID()
Dim oRefs As References
Set oRefs = Application.VBE.ActiveVBProject.References

    On Error GoTo OnError
        ' Syntax: AddFromGuid(Guid, Major, Minor)
        ' The Major version number of the reference.
        ' The Minor version number of the reference.
        ' Microsoft XML, v6.0 :: Major - 6, Minor - 0
    oRefs.AddFromGuid "{F5078F18-C551-11D3-89B9-0000F81FE221}", 6, 0

OnError:
End Sub
Sub xlfVBERemoveReference1()
Dim oRef As Reference
Dim oRefs As References
Set oRefs = Application.VBE.ActiveVBProject.References
Dim i As Integer
    For Each oRef In oRefs
        i = i + 1
        If oRef.Name = "Office" Then
       
            oRefs.Remove oRef
            'Debug.Print oRefs.Item(i).Name & " - " & oRefs.Item(i).Type
            Exit For
        End If
    Next oRef

End Sub
Sub xlfVBERemoveReference2()
Dim oRef As Reference
Dim oRefs As References
Set oRefs = Application.VBE.ActiveVBProject.References

    For Each oRef In oRefs
        If oRef.Description = "Microsoft Office 12.0 Object Library" Then
            oRefs.Remove oRef
            Exit For
        End If
    Next oRef

End Sub

Run the ListReferences on working computer and use those values for the Add references on the non working computer.
 
Thank you @Gasman

Should I delete the reference first and then register it, or is it enough to just change the fullpath?

The oRefs name (Office) and Guid (2DF8D04C-5BFA-101B-BDE5-00AA0044DE52) are the same but do I then need to change the correct FullPath for each Office versions? (how many)

C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\MSO.DLL
...
C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE13\MSO.DLL
 
Use the AddReference not the Guid version.
You can try without deleting, but I would probably delete it first. I would expect the same GUID to appear after adding.
I still have not managed to fix mine, as no access to system, and mine is hijacked by a wps product.
I ran the list function on both computers and only the office differed with me.
 

Users who are viewing this thread

Back
Top Bottom