ts wrote:
> how to paste with vba or vbscript a text file ( which is actually a director
> listing: dir a-dir/b) into the new line after the cursor is sitting? hi ts,
What you are looking for is "insert => file" (look for the
"insert" menu item, and the "file... " submenu item.
I'm not going to suggest any code, but you can do that for
yourself using the "macro recorder". Bring up your document,
then turn on the macro recorder. Go through the operations
you want to record, such as inserting your text file into
your document, then turn off the recorder.
What you get is a "macro" recorded in the vba language.
You can use it in msWord as is, _or_ you can do the entire
thing via script. You instantiate msWord ("Word.Application"),
open your file, and then "convert your vba macro to script", to
get your text file inserted into the word document. (note:
converting the macro is pretty easy, with only a couple of
"gotchas" -- which can ge easily found by (adv) googling
this ng).
cheers, jw
____________________________________________________________
You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
the answers will be applicable to the questions)
--- <boilerplate: using macro recorder to script msWD/XL> ---
I don't have any scripts handy, but my standard advice for
a situation like this is to turn on your excel macro recorder,
go through the operation you want to do "manually" (say, for
the first two worksheets), then turn off the macro recorder.
Go to the editor for macros, and pick out the vba macro code.
You then convert the vba to vbs -- not too hard to do -- but
there are a couple of things to watch out for. The most
common "thing to watch out for" is named arguments to functions
or subs. You are going to have to enter the argument values
(without the names) in their proper order.
A more definitive statement of "things to watch out for"
(when converting vba to vbs) may be found in the ng archives.
Go to:
http://groups.google.com/advanced_group_search
Also, there are many postings about using excel's automation
interface, and converting vba to vbs in this very newsgroup,
which can also be located using google's group search.
--- <end of macro recorder boilerplate> ---