View Single Post
 
Old 03-08-2022, 05:40 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I did some searching and found this which looked promising for using the VBA Project name rather than the filename but I couldn't get that to work anyway.

I did get it going by adding a Reference pointing at the addin (shown via its VBA project name) and dropping the project name from the command that calls it.
Code:
Sub RunATest()
  'Include a reference to the addin's VBA project name (TestAddin)
  Application.Run "TestAddin!ShowMessage", "Specifying the Project Name fails"    'failed
  Application.Run "modName.ShowMessage", "Including the addin's module name works"    'worked
  Application.Run "ShowMessage", "Being even less specific works too"    'worked
End Sub
My addin contained a Public Function - you may need to make it Public as well. The code in the addin for my test was
Code:
Option Explicit

Public Function ShowMessage(sMsg As String)
  MsgBox sMsg
End Function

Sub aTest()
  ShowMessage "hello world"
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote