- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 6# metrostar
- Sub zhz3230()
- Dim D As Object, Tx As Object, i%, TestFile$, MyChar$, ch$
- Dim Fs As Object, OldFile As String, SaveFile%
- Set Fs = CreateObject("Scripting.FileSystemObject")
- TestFile = ThisWorkbook.Path & "\SP20101002.txt" '½Ðקאּ¥¿½TÀɮ׸ô®|
- OldFile = ThisWorkbook.Path & "\OldTxt.txt"
- Fs.Copyfile TestFile, OldFile '½Æ»s¨Ó·½ÀɼȦs
- Set D = CreateObject("scripting.dictionary")
- Open TestFile For Input As #1 ' ¶}±ÒÀɮסC
- Do While Not EOF(1) ' °õ¦æ°j°éª½¨ìÀɧÀ¬°¤î¡C
- Input #1, MyChar ' ±N¸ê®ÆŪ¤JÅܼƤ¤¡C
- If InStr(MyChar, Chr(9)) Then ch = Chr(9) Else ch = Space(1) '¨ú±o¸ÑªR¦r¤¸
- D(Trim(Split(MyChar, ch)(0) & "")) = "" '¨úªºÂ¸ê®Æ
- Loop
- Close #1 ' Ãö³¬ÀɮסC
- Set Tx = Fs.OpenTextFile(TestFile, 8, -2)
- With Sheets("Sheet1")
- For i = 2 To .[a65536].End(3).Row
- If D.exists(Trim(.Cells(i, 2))) = False Then ' Sheet1ªºBÄæ ¤ñ¹ï¸ê®Æ
- Tx.WriteLine .Cells(i, 2) & " " & .Cells(i, 1) '¼g¤JÀÉ®×
- End If
- Next
- End With
- Tx.Close ' Ãö³¬ÀɮסC
- Set Tx = Nothing
- Set D = Nothing
- 'Âл\ìÂÂÀɦW-> ì¨ÓÀɮצsÀÉ ->¤£°Ê¥¦
- '«Ø·sÀɦW -> ì¨ÓÀɮפ£¦sÀÉ
- If MsgBox("½T©w «Ø·sÀɦW??", vbQuestion + vbYesNo, "¥t¦s·sÀÉ") = vbYes Then
- With Application.FileDialog(msoFileDialogOpen)
- .AllowMultiSelect = False
- .FilterIndex = 6
- If .Show = True Then
- Fs.Copyfile TestFile, .SelectedItems(1) '½Æ»s¨Ó·½ÀÉ
- Fs.Copyfile OldFile, TestFile 'ÁÙì¨Ó·½ÀÉ -> ì¨ÓÀɮפ£¦sÀÉ
- End If
- End With
- End If
- Kill OldFile '²M°£¨Ó·½¼È¦sÀÉ
- End Sub
½Æ»s¥N½X |
|