Solved

Automatically Gaining Focus

Posted on 2004-04-04
1
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

739 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