Cenderze
Cenderze

Reputation: 1212

VBA does not recognize my company's user defined function

I'm conducting a VBA code where I use a function defined by the company. This function is contained in a Project which is Password protected, which I will not get access to, and I'm rather sure it should not be needed.

I can call the function through the worksheet "directly", i.e. in a cell I can write =TONNES(B2,B3,B4) and the cell output is the correct value. However in VBA when I use:

Private Sub CommandButton1_Click()
   Dim param1 as String, param2 as String, param3 as String
   param1 = Cells(2,2)
   param2 = Cells(2,3)
   param3 = Cells(2,4)
   Cells(1,3) = TONNES(param1, param2, param3)
End sub

I get the error that the function TONNES is not a sub or function.

I have saved my Macro in a Module, and I don't have access to the actual code of the User defined function. Is there a way to be able to use this through VBA? As it can be used directly in the worksheet, but not through VBA, can that conclude that the function is disabled through VBA for some reason?

EDIT: The function is an add-in (more specifically I have a Company add-in which contains the data from production in a summarization page, which has created these functions in order to present these in the summarization page).

Upvotes: 1

Views: 288

Answers (1)

Cenderze
Cenderze

Reputation: 1212

So I've finally found a solution. Basically going into Tools -> References in the VBA Environment (Alt + F11) and adding in the specific references caused a solution to this issue. Hopefully this may be of help for someone else with this problem.

Upvotes: 1

Related Questions