LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Code stops prematurely unless VB Editor open...

It stops on the second iteration of a loop at a point that it successfully
gets through when there is only a single iteration.

I'm grabbing the visible text of a webpage using SendKeys to manipulate the
menus in IE. Using CTRL+A, CTRL+C, and then coming back to Excel and doing
CTRL+V doesn't work at all -- using CTRL in a SendKeys statement has never
worked for me. But using the percent symbol for ALT does work:

(with IE as the active app)

SendKeys "{TAB 4}", True
SendKeys "%e", True
SendKeys "{DOWN 3}", True
SendKeys "{ENTER}", True
Wait (0.2)
SendKeys "%e", True
SendKeys "{DOWN 1}", True
SendKeys "{ENTER}", True
Wait (0.2)
AppActivate "Microsoft Excel"
Cells(CurURLReadRow, 10).Select
SendKeys "{F2}", True
ActiveSheet.Paste
SendKeys "{ENTER}", True

----------

Since I'm using several SendKeys statements, I can't freely run the code to
the point where it stops with the VB Editor open, because it "sends the keys"
to the VB Editor.

When there's a second URL to process, the code stops after executing:
SendKeys "{F2}", True

It's as if there is nothing in the clipboard to paste, AND as if there's no
other code after that either. But in the IE window, the page contents are
selected, just as in the case where there's only a single iteration.

I'm open to a better way to do a lot of this. Manipulating the IE document
object seems to be haphazard at best. It works for grabbing the Title and
Description tags, but then it tells me that the number of IMGs and H2s is
zero, when I'm looking right at them in the source. So I'm using it for the
tags that it seems to handle properly, but the more examples I test with, the
more I'm finding that the code isn't working as well as I thought it was.

The most frustrating part is that I have found a workaround -- using
SendKeys -- and it works, but only for one iteration.

Using Excel 2000 on an XPSP2 machine.

TIA...

Gregg Roberts
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB Code stops working Michelle K Excel Programming 17 August 17th 07 05:58 PM
Code Stops Prematurely Halray Excel Programming 3 August 18th 05 03:10 PM
Code stops at range Pat Excel Programming 3 February 16th 05 07:02 PM
(trying again...) code stops executing Mark Kubicki Excel Programming 0 December 4th 03 02:00 PM
VBA code stops executing Mark Kubicki Excel Programming 0 December 3rd 03 06:47 PM


All times are GMT +1. The time now is 05:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"