Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call Fully qualified Procedure with Application.Run

Status
Not open for further replies.

lameid

Programmer
Jan 31, 2001
4,207
0
0
US
I am trying to write my own version control code to manage ensuring I have the latest module in each instance of databases...

To that end I would like a generic way to call the version out of each module. I was thinking something like the below using application.run but it does not like that syntax.

Intuitively it seems like the scope somehow can't see the correct module but the modules are all in the Application object... Secondly I am not sure the parameter will pass and return but a stack overflow post suggests it would.

Code:
Sub ModuleVerTest()
  Dim lngVersion As Long
  Application.Run "mdlBrand.Version", lngVersion 'cannot find mdlBrand.Version    Error 2517
  'mdlBrand.Version lngVersion 'works if commented in and above commented out
  Debug.Print lngVersion
  
End Sub

Code in each module would look similar to the below

Code:
Const conmdlBrandversion As Long = 2

Public Sub Version(Optional ByRef lngReturn As Long = 0)
  lngReturn = conmdlBrandversion
End Sub
 
You can try:
Code:
Public Property Get ModuleVersion()
   ModuleVersion = 2
End Property
called by:
[tt]MsgBox SomeModule.ModuleVersion[/tt]




combo
 
Both the property and function version will execute if called conventionally. I want to use Application.run with a string parameter so I can change the input... Perhaps loop all records in a recordset and for all present modules, check to see if the version is the latest version... To do that I have to be able to execute a procedure as a parameter to application.run or some other similar methodology.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top