View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Walter Briscoe Walter Briscoe is offline
external usenet poster
 
Posts: 279
Default Copying/cloning an object

I do a lot of scraping information into Excel 2003 from the Internet via
Internet Explorer (IE).

[I find that I can safely open an instance of IE and make 100
interactions. If I set the limit as 200 interactions, IE sometimes fails
and Excel stops until I manually acknowledge the failure.]

I would like to do overlapped IO. Grab the first piece of data from IE,
copy it, send for the second piece of data and find it available when I
come to process it.
However, I find I have a misunderstanding of the Set Statement. It does
not take a copy of an object; it increases the reference count to the
object.
How do I copy an object?

My outline code is

Public ie As SHDocVw.InternetExplorer ' Needs
Tools/References/Microsoft Internet Controls

TxURLretry disambiguator & ActiveCell ' Sets ie
Set ieCopy = ie ' This does not copy ie
TxURLNavigate disambiguator & ActiveCell(2, 1) ' Sets ie
' That call changes ie and ieCopy.

I could possibly open 2 instances of IE, but the code for that is likely
to be significantly more complicated.

I have several requirements, where overlapping is likely to be useful.
One consists of ~1400 interactions, where each ~2 second interaction is
followed by ~4 seconds of processing.
Another consists of ?20K 2 second interactions. Overlapping the IO could
lead to a potential saving of ~6 hours.

I've done a bit of Googling on this.
Wikipedia has "There is no built-in method for deep copies of Objects in
VBA".
A Visual Basic DoCmd.CopyObject Method might be usable to those with the
skill.

I think I may have to adopt a 2 instance method.

I already tried running 2 instances of Excel, each on half the data.
I had to do some post-processing, and was not convinced the effort was
justified.
--
Walter Briscoe