Question : extract element from string

I would like to extract the drive type from a client string and return that as a string

so here follows client input strings and required output

300E SUV 4X4 result = 4x4
300E SUV 4 X 4 result = 4x4
300E SUV 2 X 2 result = 2x2
300E SUV 2X2 result = 2x2
300E SUV 2X4 result = 2x4 and so on

I have amended some code from previous assistance but the function doesnt return result
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
Function GetDrive(ClientStr As Variant) As Variant
Dim regex As Object
Dim match As Object

    Set regex = CreateObject("vbscript.regexp")
    'filter for numerals and "d separated by space"
    regex.Pattern = "[0-9]+ X + [0-9]"

    'turn off case
    regex.IgnoreCase = True
    'create object

    Set match = regex.Execute(ClientStr)
    'set or get value
    If match.Count > 0 Then GetDrive = Trim(Val(match(0)))
    'kill object
    Set regex = Nothing
End Function

Answer : extract element from string

This error message usually points to the email editor that you are using and is not set properly. Please do the following steps...

- Click Start, click Run, type regedit in the Open box, and then click OK.
- Locate and then click the following registry subkey:
HKEY_CURRENT_USER\Software\Microsoft\Shared Tools\Proofing Tools\Custom Dictionaries

- Set the value of CUSTOM.DIC to 1.
- Exit Registry Editor

Hope this helps~!
Random Solutions  
 
programming4us programming4us