Something like this (assumes there is a space after the "code" you need to identify):

Code:
Sub grabVal()
    Dim i As Integer
    Dim j As Integer
    Dim phraseLength As Integer
    Dim phraseToCheck As String
    Dim myCode As String
    
    phraseToCheck = Range("a1").Value
    phraseLength = Len(phraseToCheck)
    
    For i = 1 To phraseLength - 2
        If Mid(phraseToCheck, i, 3) = "DWB" Then
            'check for next space
            For j = i + 3 To phraseLength
                If Mid(phraseToCheck, j, 1) = " " Then
                    'found space
                    myCode = Mid(phraseToCheck, i, j - i)
                    GoTo BailOut
                End If
                If j = phraseLength And myCode = "" Then
                    'in this case the code went to the end of the phrase
                    myCode = Mid(phraseToCheck, i, phraseLength - i)   'check the math on this one
                    GoTo BailOut
                End If
            Next j
        End If
    Next i
BailOut:
    MsgBox myCode
End Sub