|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
zhu086 发表于 2014-7-5 15:10
不知道为什么,1.csv和2.csv下载下来,要先编辑保存,再去执行宏,就不会出现1.csv和2.c ... - Sub Macor1()
- Dim myPath$, MyFile$, s$(), d As Object, t$
- Set d = CreateObject("scripting.dictionary")
- myPath = ThisWorkbook.Path & ""
- MyFile = Dir(myPath & "*.csv")
- Do While MyFile <> ""
- Open myPath & MyFile For Input As #1
- s = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbCrLf)
- Close #1
- Open myPath & MyFile For Output As #1
- For i = 0 To UBound(s)
- If Len(s(i)) Then
- If InStr(s(i), "等待买家付款") = 0 And InStr(s(i), "交易关闭") = 0 Then
- t = Split(s(i), ",")(0)
- If Not d.Exists(t) Then
- d(t) = ""
- Print #1, s(i)
- End If
- End If
- End If
- Next
- Close #1
- MyFile = Dir()
- Loop
- End Sub
复制代码 |
|