excel vba怎么以txt方式打开文本文件
excel vba如何以txt方式打开文本文件
如题
------解决方案--------------------
仅供参考
------解决方案--------------------
楼上的代码是什么意思?
怎么都是一行的呢?
是VB语句的么?
------解决方案--------------------
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\alltext.txt", True)
for each page in ThisDocument.Pages
a.WriteLine("----页:"+page.name+"----")
for each shape in page.Shapes
a.WriteLine(shape.Text)
next
next
a.Close
Set a=Nothing
Set fs=Nothing
楼主自己查下联机帮助FSO部分有详解。
------解决方案--------------------
Workbooks.OpenText Filename:="D:\a.txt", Origin:=936, StartRow:=1, _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter _
:=False, Tab:=False, Semicolon:=False, Comma:=False, Space:=False, _
Other:=False, FieldInfo:=Array(1, 2), TrailingMinusNumbers:=True
以txt方式打开d:\a.txt
如题
------解决方案--------------------
仅供参考
?"begin...";: _
Set fs = CreateObject("Scripting.FileSystemObject"): _
Set a = fs.CreateTextFile("c:\alltext.txt", True): _
for each page in ThisDocument.Pages: _
a.WriteLine("----页:"+page.name+"----"): _
for each shape in page.Shapes: _
a.WriteLine(shape.Text): _
next: _
next: _
a.Close: _
Set a=Nothing: _
Set fs=Nothing: _
?"end"
------解决方案--------------------
楼上的代码是什么意思?
怎么都是一行的呢?
是VB语句的么?
------解决方案--------------------
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\alltext.txt", True)
for each page in ThisDocument.Pages
a.WriteLine("----页:"+page.name+"----")
for each shape in page.Shapes
a.WriteLine(shape.Text)
next
next
a.Close
Set a=Nothing
Set fs=Nothing
楼主自己查下联机帮助FSO部分有详解。
------解决方案--------------------
Workbooks.OpenText Filename:="D:\a.txt", Origin:=936, StartRow:=1, _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter _
:=False, Tab:=False, Semicolon:=False, Comma:=False, Space:=False, _
Other:=False, FieldInfo:=Array(1, 2), TrailingMinusNumbers:=True
以txt方式打开d:\a.txt