写入外部文件 [英] writing to an external file
问题描述
只是一个快速的问题,可能已被问了一百万次,但我在搜索时找不到它,所以这里是:
i需要复制word文档的内容并使用VBA将其粘贴到外部文件(.txt)我该怎么做呢?
欢呼黑匣子
嘿伙计们,
只是一个快速的这可能已被问了一百万次,但我在搜索时找不到它,所以这里是:
i需要复制word文档的内容并将其粘贴到使用VBA的外部文件(.txt)如何进行此操作?
欢呼Black Box
hi
尝试使用菜单Extra |宏|记录新宏
然后执行''另存为...'作为txt文件。
关闭录音并查看已写入的单词(Alt + F11)
类似
展开 | 选择 | Wrap | 行号
这很好,但后来我需要引用该文本。我该怎么做?
黑盒子
这很好,但是后来我需要回头看那段文字。我该怎么做?
黑盒
嗨如果你想通过VB访问它你只需要使用OPEN ...
打开" Newname.txt"输入为#1
虽然不是EOF(1)
线路输入#1,p
..
..在这里放任何好的代码..
..
Wend
关闭#1
hey guys,
just a quickie that''s probably been asked a million times, but i couldn''t find it when searching so here goes:
i need to copy the contents of a word document and paste it to an external file (.txt) using VBA how do i go about doing this?
cheers Black Box解决方案hey guys,
just a quickie that''s probably been asked a million times, but i couldn''t find it when searching so here goes:
i need to copy the contents of a word document and paste it to an external file (.txt) using VBA how do i go about doing this?
cheers Black Boxhi
try using menu Extra | macro | record New Macro
then perform a ''save as ...'' as txt file.
close the recording and look what word has written (Alt+F11)
something like
Expand|Select|Wrap|Line Numbers
that''s fine, but later i need to refer back to that text. how would i do that?
black box
that''s fine, but later i need to refer back to that text. how would i do that?
black boxhi if you want it accessed by VB you need only to use OPEN ...
Open "Newname.txt" For Input As #1
While Not EOF(1)
Line Input #1, p
..
.. put any nice code here ..
..
Wend
Close #1
这篇关于写入外部文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文