Problem getting AddIns accessible from VB

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created the following function:

Public Function Convert_Column_Values_Str_to_Int(ColumnValueStr)
'
' Convert_Column_Values_Str_to_Int Macro
' Macro recorded 2006-07-18 by ervbb
'
'
********************************************************************************
' This macro convert the column value on format A..Z, AA..AZ, BA..BZ, ...
' to format 1..26, 27..52, 53..78, ... .
'
********************************************************************************
'
ColumnValueInt = 0

If Len(ColumnValueStr) = 1 Then
ColumnValueInt = Asc(ColumnValueStr) - 64
Else
ColumnValueInt = (Asc(Left(ColumnValueStr, 1)) - 64) * 26 +
Asc(Right(ColumnValueStr, 1)) - 64
End If

' Set the function value
Convert_Column_Values_Str_to_Int = ColumnValueInt

End Function

and stored it in an .xla file on C:\Document and Settings\ervbb\Applivation
Data\Microsoft\AddIns. I have installed it by marking it in Tools/AddIns and
restarted Excel. But when I try to call it from my VB-macro I've get the
following error message from Microsoft Visual Basic: "Compile error: Sub or
Function not defined."

What is wrong/missing?

BR Bengt
 
Hi Ron,

Thanks for a quick answer!

In Tools>References I've browsed to add my AddIns to the list in Available
References.
But when I click OK I've got an error message: Name conflicts with existing
module, project, or object library.
I've changed the Project Name in the Project Properties and tried again, but
it does'nt helped.

Any ideas whats wrong?

BR Bengt
 
Hi Bengt

Apologies for commenting on something else. Your names describe the
datatype, but the variable and returntypes themselves are nondeclared,
therefore Variants. Consider doing it like this:

Public Function Convert_Column_Values_Str_to_Int(ColumnValueStr As String)
As Integer

HTH. Best wishes Harald
 
Hi Ron,

I think the problem was that I've tried to make a reference to it self, not
from the calling module.
When I started from scratch (with other names) I've succeded.

Thanks a lot for your answer and have a nice weekend!

BR Bengt
 
Back
Top