[问题] VBA 读档后用两个符号分割字串

楼主: csieain ( )   2013-05-17 16:26:59
各位大大… 小妹实在是VBA的新新新手…
想要求助一下
目前读档后只能用一个符号分割字串
可否帮忙看看要怎么改才能用两个符号,分别是" "以及"|"来区分
而且重复的符号视为一个
Option Explicit
Private Sub MemoryLoad()
Dim Separator As String
Separator = " "
ThisWorkbook.Sheets(2).Columns.Delete
Dim v, qt
With Application.FileDialog(3)
.Filters.Clear
.Filters.Add "All Text Files", "*.txt"
.AllowMultiSelect = True
.Title = "Please select txt file"
If .Show Then
For Each v In .SelectedItems
Set qt = ThisWorkbook.Sheets(2).QueryTables.Add("TEXT;" & v,
ThisWorkbook.Sheets(2).Range("A2"))
qt.TextFileOtherDelimiter = Separator
qt.Refresh True
Next
End If
End With
ActiveWorkbook.Sheets(2).Select
MsgBox "Finish!"
End Sub
感谢各位大大…

Links booklink

Contact Us: admin [ a t ] ucptt.com