I am posting some of this as an answer, because I cannot comment.
@ Badja : You said ….” I understand that if your sub has no arguments, then Application.Run has a use – …” I am not sure if you are possibly implying that Application Run can have no arguments? - That is not the case. In principal , you can use arguments with Application.Run just as you can with Call. The syntax and general working of it can be a bit more difficult to understand than with Call. I agree with you , that documentation on Application.Run is very sparse.
@Hasib_Ibradzic : I was not aware that you can use the Call function with strings. ??
As far as I know, it is one of the advantages of Application.Run over using Call, that the macro name part of the argument is taken as a sting, so that you can build that string up with variables. So you are not limited to hard coding, as I think is the case with using Call
@Dude_Scott : In your example, I think it is advisable to suggest/ note that including the module code name could be advisable. Without this, you could experience problems if you had Sub routines with the same name in different modules.
In your example, this could be advisable to do
Sub callPriv()
Application.Run "Module1.priv"
End Sub
_._____________
Some other things that might be useful to Note:
If you have a macro in another module which is Public, then you can Call it from another module
For example. In my ( German ) Excel I have in my first normal module , code name Modul1
, ( In English Excel, I think that would typically be by default Module1
), this
Public Sub PbicModule1() '
MsgBox "Pubic Modul1"
End Sub
And in my first worksheet class code module, code name Tabelle1
( In English Excel I think that would typically be by default Sheet1
) , I have this
Public Sub PbicTabelle1() '
MsgBox "Pubic Tabelle1"
End Sub
And in my ThisWorkbook class code , code name DieseArbeitsmappe
( In English Excel , I think that would typically be by default ThisWorkbook
), I have this
Public Sub PbicThisWorkbook() '
MsgBox "Pubic ThisWorkbook"
End Sub
The following macro will work when it is in any module
Private Sub CallMePubics() ' https://stackoverflow.com/questions/55266228/difference-between-calling-a-sub-and-application-run
Call Modul1.PbicModule1
Call Tabelle1.PbicTabelle1
Call DieseArbeitsmappe.PbicThisWorkbook
End Sub
That last macro would fail if the called macros were Private.
This following macro equivalent using Application.Run , would work regardless of whether the called macros were Public or Private
Private Sub AppRunMePubics()
Application.Run Macro:="Modul1.PbicModule1"
Application.Run Macro:="Tabelle1.PbicTabelle1"
Application.Run Macro:="DieseArbeitsmappe.PbicThisWorkbook"
End Sub
So , the conclusion from that is adding slightly to what Dude_Scott said:
Application.Run allows you to run, from anywhere, both Private subs and Public subs that are anywhere.
Call only allows you to run from anywhere, Public subs that are anywhere
Ref:
https://stackoverflow.com/questions/31439866/multiple-variable-arguments-to-application-ontime
http://excelmatters.com/2017/04/07/passing-arguments-byref-using-run/
Example Workbook with my coding: MainFile.xls : https://app.box.com/s/prqhroiqcb0qccewz5si0h5kslsw5i5h
http://www.tushar-mehta.com/publish_train/xl_vba_cases/1022_ByRef_Argument_with_the_Application_Run_method.shtml