Wie definiere ich die variable SchleifenIndex ??
Option
Explicit
Sub
Aufrufen()
Call
Makro_von_Jemanden(
"*Grunz* Du verdammt smarter Typ du!"
)
End
Sub
Function
Makro_von_Jemanden(Parameter
As
String
)
As
Long
Call
MsgBox(Parameter, vbInformation)
Makro_von_Jemanden = 42
End
Function
Sub
Test()
Dim
RegExp
As
VBScript_RegExp_55.RegExp
Dim
Matches
As
VBScript_RegExp_55.MatchCollection
Dim
Expr
As
String
Dim
i
As
Long
Dim
j
As
Long
j = 1
For
i = 1
To
332135
Step
3
Cells(j, 1).Value = i
j = j + 1
Next
With
New
RegExp
.Global =
False
.IgnoreCase =
True
.MultiLine =
False
Call
Test(Worksheets(
"Tabelle1"
).Range(
"A"
& SchleifenIndex))
Expr = .Offset(0, 0).Value & .Offset(1, 0).Value & .Offset(2, 0).Value
End
With
.Pattern =
""
"<img(.*?)>.*?</img>"
"(,\d+)"
Set
Matches = .Execute(Expr)
Dim
Part1
As
String
Dim
Part2
As
String
Dim
Part3
As
String
If
Matches.Count > 0
Then
Part1 = Left$(Expr, Matches(0).FirstIndex)
Part3 = Matches(0).SubMatches(1)
.Pattern =
"src="
""
"(.+?)"
""
""
Set
Matches = .Execute(Expr)
If
Matches.Count > 0
Then
Part2 = Matches(0).SubMatches(0)
Else
Range(
"A5"
).Value =
""
Call
MsgBox(
"Angabe zu Image-Source nicht gefunden."
, vbExclamation)
Exit
Sub
End
If
Range(
"A5"
).Value = Part1 & Part2 & Part3
Call
MsgBox(
"Fertig."
, vbInformation)
Else
Range(
"A5"
).Value =
""
Call
MsgBox(
"Nix gefunden."
, vbExclamation)
End
If
End
With
End
Sub