Let's say we have a text file called text.txt. Within this text file are two lines of interest.
src="somethingrandom1111.png"
src="morerandomnumberstuffthisnamewillvary.png"
What I want to do is search the entire document for src=" and then replace everything that comes after that with some other string until another " is found. So,
src="somethingrandom1111.png"
src="morerandomnumberstuffthisnamewillvary.png"
Would become
src="thiswasreplace.gif"
src="thistoo!.jpg"
This is a part of my code:
TempFile = Environ$("temp") & "\" & "index.htm"
With TempWB.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=TempFile, _
Sheet:=TempWB.Sheets(1).Name, _
Source:=TempWB.Sheets(1).UsedRange.Address, _
HtmlType:=xlHtmlStatic)
.Publish (True)
End With
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, 0)
ts = Replace(ts, 'src="', something)
ts.Close
src="and then use methods likeMidto get the filename in order to replace it.