Solved

Automatically Gaining Focus

Posted on 2004-04-04
1
230 Views
Last Modified: 2010-05-02
Hi,

I have some code that i got from EE. Here is it:
Dim IE
Set IE = createobject("internetexplorer.application")
     IE.navigate "http://www.google.com/search.htm"
     While IE.busy : Doevents : Wend
     RET = IE.document.documentelement.innertext

Set IE=nothing

' RET now contains the comma seperated info

It is meant to get everything out of the page 'search.htm  for example ' and display it in a label. It fulfills this job perfectly. However, there is a minor porblem with it. If you change your focus on your computer from the program to another program, e.g Internet Explorer, every minute, you will temperarily loose focus and then gain it again. It is because the above code is in a timer.


How can i stop the program from automatically gaining focus?

0
Comment
Question by:qwertykeyboard
1 Comment
 
LVL 6

Accepted Solution

by:
___XXX_X_XXX___ earned 40 total points
ID: 10751537
Declare IE object in declarations section of form and dont set it to Nothing. Like this:

 ' In declarations section:
Dim IE

Private Sub Form_Load()
Set IE=createobject("internetexplorer.application")
End Sub

Private Sub Timer1_Timer()
Dim RET
IE.navigate "http://www.google.com/search.htm"
While IE.busy : Doevents : Wend
RET = IE.document.documentelement.innertext
End Sub

This solves this "focus" problem here.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question