Blade Hunter
Well-known Member
- Joined
- Mar 13, 2008
- Messages
- 3,147
Hi Guys, so I created a couple of UDF's and I want to roll them out in an addin.
I created a new workbook, added a module, pasted my 2 UDF's in there and saved as an XLAM (Excel 2007)
I then went to the add ins option in Excel 2007 and added it in. All was well so far.
When I went to use the UDF's, they don't come up in the suggested list as I type them and I end up with #NAME? so it is clearly not picking them up. Have I done something wrong?
Cheers
Dan
I created a new workbook, added a module, pasted my 2 UDF's in there and saved as an XLAM (Excel 2007)
I then went to the add ins option in Excel 2007 and added it in. All was well so far.
When I went to use the UDF's, they don't come up in the suggested list as I type them and I end up with #NAME? so it is clearly not picking them up. Have I done something wrong?
Code:
Option Explicit
Public Function GetProdID(UPC As String)
Dim Conn As New ADODB.Connection
Dim RS As New ADODB.Recordset
Dim Cmd As New ADODB.Command
Conn.Open "PROVIDER=MSDAORA.Oracle;DATA SOURCE=removed;USER ID=removed;PASSWORD=removed"
Cmd.ActiveConnection = Conn
Cmd.CommandType = adCmdText
Cmd.CommandText = "SELECT temp_raas_prod_no_from_dig ('95', '" & UPC & "', '') FROM dual"
Set RS = Cmd.Execute
GetProdID = RS.Fields(0).Value
End Function
Public Function GetUPC(ProdID As String)
Dim Conn As New ADODB.Connection
Dim RS As New ADODB.Recordset
Dim Cmd As New ADODB.Command
Conn.Open "PROVIDER=MSDAORA.Oracle;DATA SOURCE=removed;USER ID=removed;PASSWORD=removed"
Cmd.ActiveConnection = Conn
Cmd.CommandType = adCmdText
Cmd.CommandText = "SELECT barcode FROM b_vras001 WHERE prod_no = '" & ProdID & "' AND client_key = '0000'"
Set RS = Cmd.Execute
GetProdID = RS.Fields(0).Value
End Function
Cheers
Dan