Solved

Automatically Gaining Focus

Posted on 2004-04-04
1
235 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

687 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