This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Workbooks.OpenText Filename:="xxx.STA", Origin:= _ | |
950, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _ | |
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, Comma:=True _ | |
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), _ | |
Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1)), _ | |
TrailingMinusNumbers:=True |
你可以加入參數DataType:=xlDelimited,(DataType一定要是xlDelimited,才能使用Comma:=True)後告知Comma:=True,要以逗號為分隔字元
reference: https://msdn.microsoft.com/zh-tw/library/office/ff837097.aspx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wb = Workbooks.Open(Filename:=myPath & myFile, Format:=2) |
我找到的範例是使用Open方法,此時可以用Format這個參數,Format:=2就是以逗號為分隔
reference: https://msdn.microsoft.com/en-us/library/office/ff194819.aspx
沒有留言:
張貼留言