将邮件里面的联系人全部导出(for Winmail) 有缺陷,不过目的达到了

by 曾经沧海
469 阅读

Main 

Sub Main()
Dim fso, f1, ts, s
Const ForReading = 1
Set fso = CreateObject(“Scripting.FileSystemObject”)

Set f = fso.GetFolder(“C:\Users\海军\Desktop\JUNFAN”)
Set fc = f.Files

For Each f1 in fc
Set ts = fso.OpenTextFile(f1.name , ForReading)
  s = ts.ReadLine
do While  left(s,3)<>”To:” and ts.AtEndOfStream <> True
  s = ts.ReadLine
  ‘ts.Skipline 
loop

ts.Close
WriteFiles(s)
‘Msgbox(f1.name & s) 
Next

End Sub

Sub WriteFiles(T)
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject(“Scripting.FileSystemObject”)
Set f = fso.OpenTextFile(“out.txt”, ForAppending, True)
f.Write T
f.Writeline
f.Close
End Sub
============================
保存为.vbs结尾的文件,运行

发表评论