I want to perform the following "actions" with a vbs script.

1)Start Internet Explorer
2)Start MS Word
3)Navigate to a specified page http
4)Select a part of this page (text+formatting and images)
5)Copy it
6)Paste it to a Word document

Is it possible?
My problem is how to select+copy and past via vbs as if in interactive
mode (points 4-6).
In spite of many attempt to find something useful on Google Groups, I
couldn't find anything clear about it...


Nicola Attico
Rome, Italy

Copy+paste with vbs (IE->Word) by Tom

Tom
Wed Dec 03 15:11:05 CST 2003

I haven't done a lot of testing, but this script fragment
seems to do what you want ...

With CreateObject("InternetExplorer.Application")
.Navigate "http://www.microsoft.com"
do until .ReadyState = 4 : Wscript.Sleep 100 : Loop
.visible = true
With .document
.execcommand "SelectAll"
.execcommand "Copy"
end with ' document
With CreateObject("Word.Application")
.Visible = True
Set NewDoc = .Documents.Add
.Selection.Paste
End with
.visible = false
End with

(I pasted it together from past of a couple of other
scripts I had laying around.

Tom Lavedas
===========

>-----Original Message-----
>I want to perform the following "actions" with a vbs
script.
>
>1)Start Internet Explorer
>2)Start MS Word
>3)Navigate to a specified page http
>4)Select a part of this page (text+formatting and images)
>5)Copy it
>6)Paste it to a Word document
>
>Is it possible?
>My problem is how to select+copy and past via vbs as if
in interactive
>mode (points 4-6).
>In spite of many attempt to find something useful on
Google Groups, I
>couldn't find anything clear about it...
>
>
>Nicola Attico
>Rome, Italy
>.
>

Re: Copy+paste with vbs (IE->Word) by nicola

nicola
Thu Dec 04 08:01:02 CST 2003

"Tom Lavedas" <tlavedas@hotmail.remove.com> wrote in message news:<c5ed01c3b9e1$f6d83310$a601280a@phx.gbl>...
> I haven't done a lot of testing, but this script fragment
> seems to do what you want ...

Thanks Tom,

What if I need to copy not the whole page but only a portion of it?
I suppose I've to walt through the dom tree, but how to copy?

Nicola Attico
Rome, Italy

Re: Copy+paste with vbs (IE->Word) by Tom

Tom
Fri Dec 05 07:47:26 CST 2003

I assume, but haven't taken the time to test, that you can
select particular parts of a document acording to their
DHTML properties, such as the contents of a FORM or a
DIV ...

document.FormID.execcomand "selectall"

but, I don't see any way to start and stop selection
marking in the list of commands that execCommand can
execute (see [url all one line]):

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnmshtml/html/createwp.asp

Tom Lavedas
===========

>-----Original Message-----
>"Tom Lavedas" <tlavedas@hotmail.remove.com> wrote in
message news:<c5ed01c3b9e1$f6d83310$a601280a@phx.gbl>...
>> I haven't done a lot of testing, but this script
>> fragment seems to do what you want ...
>
>Thanks Tom,
>
>What if I need to copy not the whole page but only a
>portion of it? I suppose I've to walt through the dom
>tree, but how to copy?
>
>Nicola Attico
>Rome, Italy
>.
>