(ich lasse mich aber gerne eines Besseren belehren).
Hab noch ein wenig gesucht...und einen Forumeintrag gefunden:
http://www.office-loesung.de/ftopic83090_0_0_asc.php
VBA kann wohl doch RegEx:
Function get_bandwidth_kbit(ByVal bw) As String
Dim unit As String
Dim objRegEx As Object, objMatchCollection As Object, objMatch As Object
Dim a As Integer
Set RegEx = CreateObject("vbscript.regexp")
RegEx.Global = True
RegEx.IgnoreCase = True
RegEx.MultiLine = False
RegEx.Pattern = "([0-9]+)\s*(gb|mb|kb|b)?"
Set MatchAll = RegEx.Execute(bw)
Set Match = MatchAll(0)
If Match.submatches.Count > 0 Then
bw = Match.submatches(0)
If Match.submatches.Count >= 1 Then
unit = UCase(Match.submatches(1))
If unit = "GB" Then
bw = bw * 1024 * 1024
ElseIf unit = "MB" Then
bw = bw * 1024
ElseIf unit = "B" Then
bw = bw / 1024
End If
End If
Else
bw = 0
End If
Set RegEx = Nothing
Set MatchAll = Nothing
Set Match = Nothing
get_bandwidth_kbit = bw
End Function
Könnte zwar kürzer sein, aber funktioniert!
Thx@all!