Const ForReading = 1 Const ForWriting = 2 'Wscript.quit Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("C:\Documents and Settings\Alexander\Desktop\TEST\mtt.htm", ForReading) Do Until objFile.AtEndOfStream strLine = objFile.ReadLine 'GETTING COMPANY NAME strStart=InStr(strLine, "class=""ad_name""") if strStart<>0 Then Company=strLine Company = Replace(Company, Left(Company,strStart+15), "") strEnd=InStr(Company,"") Company=mid(Company,1,strEnd-1) 'Wscript.echo Company End If 'GETTING COMPANY ADDRESS strStart=InStr(strLine, "class=""ad_address""") if strStart<>0 Then Address=strLine Address = Replace(Address, Left(Address,strStart+18), "") strEnd=InStr(Address,"") if strEnd<>0 Then Address=mid(Address,1,strEnd-1) Else strLine = objFile.ReadLine Do While InStr(strLine,"")=0 Address = Address & strLine strLine = objFile.ReadLine Loop strEnd=InStr(strLine,"") if strEnd>1 then Address=Address & mid(strLine,1,strEnd-1) end if End If 'Wscript.echo Address End If 'GETTING COMPANY PHONE strStart=InStr(strLine, "class=""ad_phone""") if strStart<>0 Then Phone=strLine Phone = Replace(Phone, Left(Phone,strStart+47), "") strEnd=InStr(Phone,"") if strEnd<>0 Then Phone=mid(Phone,1,strEnd-1) Else strLine = objFile.ReadLine Do While InStr(strLine,"")=0 Phone = Phone & strLine strLine = objFile.ReadLine Loop strEnd=InStr(strLine,"") if strEnd>1 then Phone=Phone & mid(strLine,1,strEnd-1) end if End If strStart=InStr(Phone," ") Temp=Phone Phone=Left(Phone,strStart-1) Fax= Replace(Temp, Phone, "") strStart=InStr(Fax,"fax.gif"">") if strStart<>0 Then strStart=strStart+9 Fax=mid(Fax,strStart,InStrRev(Fax," ")-strStart) Else Fax="" End If 'Wscript.echo Phone 'Wscript.echo Fax ' wscript.quit strFinal= strFinal & Company & vbTab & Address & vbTab & Phone & vbTab & Fax & vbCrLF 'wscript.echo strFinal End If Loop objFile.Close 'Set objFile = objFSO.CreateTextFile("C:\Documents and Settings\Alexander\Desktop\CSV.txt") Set objFile = objFSO.OpenTextFile("C:\Documents and Settings\Alexander\Desktop\TEST\CSV.txt", ForWriting) objFile.WriteLine strFinal objFile.Close