Good morning to everyone.
I posted a question yesterday at
http://www.excelforum.com/showthread.php?t=601728
and the response worked perfectly.
My problem is that I would like to turn my UDF workbook into an addin.
I have placed the UDF code into a module, E.g.
Function Celsius(Deg_F As String)
' Convert degrees F to degrees C
Dim myString
myString = Deg_F
If myString = "" Then
GoTo fn_Exit
Else
Celsius = 0.0000000001 + (FormatNumber(Deg_F, 6) - 32) * 5 / 9
End If
fn_Exit:
End Function
In the regular workbook I can place the code for adding the functions to the Insert Function dialog into the This Workbook Open Event
Private Sub Workbook_Open()
On Error GoTo 0
Application.MacroOptions macro:="Celsius", _
Description:="Converts Degrees Farenheit to Degrees Celsius", Category:="Conversions"
End Sub
Or I can place the code into a module as a subroutine (addFunctions) and call it from the Workbook Open event
Private Sub Workbook_Open()
On Error GoTo 0
addFunctions
End Sub
All works as it should.
When I save as an addin, I can install the addin and all works.
But as soon as I close out of Excel and open a new Excel window, I get the error message
Run-time error "1004"
Cannot edit a macro on a hidden workbook. Unhide the workbook using the Unhide command.
I have deleted the addin, changed the code in the workbook (as above), saved again as an addin, etc.
Everything still results in the same error when I completely close out of Excel and open a new instance.
The code that is high lighted when I click to debug is
Application.MacroOptions macro:="Celsius", _
Description:="Converts Degrees Farenheit to Degrees Celsius", _
Category:="Conversions"
What is the proper way of having these functions installed?
Bookmarks