acax24enu.tbl is referencing as Autocad 2021 type library instead of 2024

acax24enu.tbl is referencing as Autocad 2021 type library instead of 2024

rheece_turner
Participant Participant
3,350 Views
7 Replies
Message 1 of 8

acax24enu.tbl is referencing as Autocad 2021 type library instead of 2024

rheece_turner
Participant
Participant
When i try and add Autocad 2024 as a reference in excel using acax24enu.tbl its importing it as autocad 2021 type library instead of 2024

 


 

0 Likes
Accepted solutions (2)
3,351 Views
7 Replies
Replies (7)
Message 2 of 8

Ed__Jobe
Mentor
Mentor
Accepted solution

Correct. The ActiveX tlb has not changed. No new features were added.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 8

rheece_turner
Participant
Participant
Accepted solution

It was not working for 2024, i went through that file as txt and changed the 2021 to 2024 and restarted, that seemed to fix it

0 Likes
Message 4 of 8

Ed__Jobe
Mentor
Mentor

@rheece_turner wrote:

It was not working for 2024, i went through that file as txt and changed the 2021 to 2024


What do you mean by that? What file? You should just go to Tools>References and select the correct tlb.

xl acad reference.png

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 5 of 8

rheece_turner
Participant
Participant

I opened it in Notepad++ in administrator mode and manually changed it to reference 2024 instead of 2021 and it seemed to work after i did that. before this it was just erroring out and saying the library was invalid.

0 Likes
Message 6 of 8

Ed__Jobe
Mentor
Mentor

I would strongly recommend against modifying a tlb like that. The tlb still references 2024 dll's. The only reason you might get an error is if you tried to use it to start a different version of acad. If you just do what I showed in the screenshot, it should work. Then use the following sub to instantiate an acad object.

 


Public Function GetAcad(Optional ver As String) As AcadApplication
    ' support multiple acad versions.
    'Sample ver for AutoCAD 2023 ' ".24.2"
    On Error Resume Next
    Dim acApp As AcadApplication
    Dim clsid As String
    clsid = "AutoCAD.Application"
    If Not ver = "" Then
        clsid = clsid & ver
    End If
    Set acApp = GetObject(, clsid)
    If acApp Is Nothing Then
        Set acApp = CreateObject(clsid)
    End If
    Set GetAcad = acApp
End Function

 

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 7 of 8

rheece_turner
Participant
Participant

yeah i know i'm kind of forcing it into doing what i want to do. everyone at my work is on the current AutoCAD 2025 with regular updates, except for a few people who are all on the same version of 2024. everything runs smoothly on the 2025 version it was just throwing up errors saying it was the wrong library or that AutoCAD wasn't open even though it was. thanks for your help, ill try and implement this and see if it works.

0 Likes
Message 8 of 8

Ed__Jobe
Mentor
Mentor

a dvb is a compiled file, not just the text you see in the ide. It gets compiled for the specific version of acad you're using and won't work on other versions. When you open up a dvb for 2024 in 2025, it automatically gets the reference to the acad tlb updated to the current version of the tlb. You can't use a dvb for 2024 on 2025 without it being upgraded, and therefore unusable to 2024. You need a separate dvb for 2025 and one for 2024. If  you are trying to create an instance of acad in Excel, then your xl code has to account for different versions. You either have to develop two spreadsheets, one that references acad 2024 and one that references acad 2025, or determine at runtime which acad tlb to reference. If you want to do it programmatically, you can use the function below. It requires setting a reference to "Microsoft Visual Basic for Applications Extensibility 5.3".


Public Function SetReferenceByFile(FilePath As String, Optional DisplayErrors As Boolean) As VBIDE.Reference
    'returns True if successful in setting a reference in the current dvb,
    'given the FilePath of a tlb, olb, dll. The DisplayErrors option determines
    'whether or not an error message will be displayed upon erroring.
    On Error GoTo ErrorHandler
    Dim objVB As Object  'VBE
    Dim objRef As VBIDE.Reference
    Dim objRefs As VBIDE.References
    Dim strPath As String
    
    Set objVB = AcadApplication.VBE
    Set objRef = objVB.ActiveVBProject.References.AddFromFile(FilePath)
    SetReferenceByFile = True
    GoTo Finish:
ErrorHandler:
    If Err.Number = 32813 Then
        'reference was already set, just return the reference
         Set objRefs = objVB.ActiveVBProject.References
         For Each objRef In objRefs
             If objRef.FullPath = FilePath Then
                 Set SetReferenceByFile = objRef
             End If
         Next objRef
    Else
        If DisplayErrors = True Then
            MsgBox Err.Number & ", " & Err.Description, vbExclamation, "SetReferenceByFile."
        Else
        
        End If
        Set SetReferenceByFile = Nothing
    End If
Finish:
    Set objVB = Nothing
    Set objRef = Nothing
End Function

 

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes