I'm trying to write a function that calls the Search Worksheet function from Excel to find the position of a character so I can use it to perform a Mid function from that posistion. The character can appear anywhere in the field.
I've referenced the Excel 9 Object Library and my function still doesn't recognise the Search as a function.
My function is below, can anyone tell me what I'm doing wrong please.
Many thanks
Martin
Public Function SplitGrp(Grp As String) As String
Dim appXL As Excel.Application
Set appXL = Search("-", Grp, 1) + 1
SplitGrp = Mid(Grp, appXL, 1)
appXL.Quit
Set appXL = Nothing
End Function
I've referenced the Excel 9 Object Library and my function still doesn't recognise the Search as a function.
My function is below, can anyone tell me what I'm doing wrong please.
Many thanks
Martin
Public Function SplitGrp(Grp As String) As String
Dim appXL As Excel.Application
Set appXL = Search("-", Grp, 1) + 1
SplitGrp = Mid(Grp, appXL, 1)
appXL.Quit
Set appXL = Nothing
End Function