Solved

Automatically Gaining Focus

Posted on 2004-04-04
1
226 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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 …
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…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now