none
Application.Run on procedure with same name in different modules RRS feed

  • Question

  • Lets say I have two modules: Module1 and Module2 in the same project

    They both have the function MyFunction()

    Using this line in the same project,

    Application.Run("MyFunction")

    how would I specify which one to use? I tried,

    Application.Run("Module1.MyFunction")

    but it couldn't find the procedure (error 2517). I need to use the Run() method because I can only pass in String values of a function to call. This isn't a problem right now, but I just want to be sure in the future.

    I'm using Access 2013.


    Monday, February 17, 2014 4:44 PM

All replies

  • Re: Can't find procedure

    Are the modules or functions declared as Private?.  That could be the problem.
    Separate names for the functions would also help... MyFunction1 & MyFunction2
    '---
    Jim Cone
    Portland, Oregon USA
    (free & commercial excel add-ins & workbooks)

    • Edited by James Cone Thursday, October 20, 2016 3:27 PM
    Tuesday, February 18, 2014 1:25 AM
  • Both of the modules are public. I'm calling the Application.Run method inside a Form's code. So yes, using unique function names is the only way I guess. I was reading

    http://msdn.microsoft.com/en-us/library/office/aa220716(v=office.11).aspx

    And it showed this example.

    Application.Run "MyProject.MyModule.MyProcedure"
    I tried that syntax and got the same error (2517).

    Tuesday, February 18, 2014 1:55 AM