Calling a procedure from an add-in (2 Viewers)

Superpat

Member
Local time
Today, 03:51
Joined
Aug 15, 2020
Messages
114
Hello, I have a problem calling a procedure from an add-in to a main file.
Code:
Sub InsererTeteTitreModule()
        Dim sCheminProjet As String
        sCheminProjet = TrouverTag()
        If sCheminProjet <> "" Then
        
    Application.Run sCheminProjet & "InsererEnTeteTitreModule"
        
                'Call InsererEnTeteTitreModule
                Debug.Print "InsererEnTeteTitreModule appelé"
            End If
End Sub
To open in :
EssaiBarreOutils8.accdb
---> InsertionBarreOutils
--------> BrandNewBarAndButton
Click on the menu : "Entête module"
 

Attachments

The call via Application.Run ...\EssaiBarreOutils8.InsererEnTeteTitreModule only works if the file has the extension accda.
It is much easier if the VBA project is already loaded: Application.Run "InsererEnTeteTitreModule"

I think this is the wrong direction.
If you use an add-in file directly from the application, you can view this file as a library that is used via Latebinding.

If I interpret your project correctly, you want to edit the codemodules of an Access application automatically.
Why do you need to use code from the application? I would rather create a “real” add-in for this and install all the code there.
Then the add-in can be used for any desired application.
You would then only have to load the Access add-in at the beginning via the Access ribbon (menu add-ins). The rest then runs via the command bar in the VBA editor.
A COM add-in could be loaded automatically.
 
Last edited:

Users who are viewing this thread

  • Back
    Top Bottom