Default browser

Hi Experts,

Every time I run the following code, since the internet explorer is not my default browser, the message "Internet Explorer is not currently your default browser. Would you like to make it your default browser?" always comes up.

Private Sub Command1_Click()
Text1 = ""
    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Navigate "http://free.timeanddate.com/clock/i1up141f/n240/tt1/tw0/tm2"
    IE.Toolbar = False
    IE.StatusBar = False
    IE.MenuBar = False
    Do While IE.Busy
        Do While IE.Busy
            DoEvents
        Loop
    Loop
    Text1 = CDate(IE.Document.getElementById("t1").InnerText)
    IE.Quit
    Set IE = Nothing
End Sub

How can I suppress or bypass that message with the Internet Explorer as the browser to get the result I want in Text1 ?
or how to use the default browser so the message above would not appear to get the same result in text1 ?

Thanks
LoGa1234567890Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ethanw023Commented:
In Internet Explorer options, click Programs, in there is a checkbox that says "Tell me if Internet Explorer is not the default browser", uncheck that.
micropc1Commented:
I'm assuming you're wanting to not require any user interaction, which is why you didn't just click "Yes" to set IE as the default browser in the first place... Have your VB code set the registry key "\HKLM\Software\Microsoft\Internet Explorer\Main\Check_Associations" to a REG_SZ value of "no". This will prevent IE from checking if it is the default browser and prevent the prompt from appearing.
DGM87Commented:
Yeah, because the code is looking for IE, so it's pulling it up.  What Micropc said should do it.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

LoGa1234567890Author Commented:
Thank you for the prompt reply !

How to code vb6 to set the registry key "\HKLM\Software\Microsoft\Internet Explorer\Main\Check_Associations" to a REG_SZ value of "no" ?
micropc1Commented:
This may help... http://www.ex-designz.net/apidetail.asp?api_id=183

Another option would be to use the shell command to run regedit.exe and import a .reg file.
http://www.robvanderwoude.com/regedit.php
LoGa1234567890Author Commented:
Hi micropc1,

Using regedit and open the Registry Editor, I can get it work with HKEY_CURRENT_USER, ( I tried HKEY_LOCAL_MACHINE, but not work).

I tried to run the following code in form_load to let vb do this job , but got error in line 5 (Set objAccount----)

Dim strComputer, strUserDN, strUserDomain, checkAssociations As String
Dim WshShell, objShell, objWMIService, objAccount As Object
  strComputer = "."
  Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  Set objAccount = objWMIService.Get("Win32_UserAccount.Name='" & strUserDN & "',Domain='" & strUserDomain & "'")
  MsgBox (strUserDN & " SID = " & objAccount.SID)
  'Read for existing SID entry for Check_Associations
  checkAssociations = "Yes"
  checkAssociations = WshShell.RegRead("HKEY_USERS\" & objAccount.SID & "\Software\Microsoft\Internet Explorer\Main\Check_Associations")
  If checkAssociations <> "No" Then
'    Create desired reg entry
    objShell.RegWrite "HKEY_USERS\" & objAccount.SID & "\Software\Microsoft\Internet Explorer\Main\Check_Associations", "No", "REG_SZ"
  End If

Please help !
micropc1Commented:
Sorry, I believe I was mistaken about HKLM...just tested it and it doesn't work. Looks like HKCU is what you want.

Try this...

Dim strComputer, CAKey, checkAssociations As String
Dim WshShell

Set WshShell = CreateObject("Wscript.Shell")
CAKey = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Check_Associations"

If WshShell.RegRead(CAKey) <> "No" Then
    WshShell.RegWrite CAKey, "No", "REG_SZ"
End If

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LoGa1234567890Author Commented:
Thanks ! micropc1, your code works perfectly.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.