Click here to Skip to main content
13,196,286 members (47,013 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I want to change the IE tab URL.

Code 1:

Imports mshtml
Public Class Form1
    Dim WithEvents IE As SHDocVw.InternetExplorer
    Dim WithEvents CurrentDoc As HTMLDocument
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim SWs As New SHDocVw.ShellWindows
        Dim IEx As SHDocVw.InternetExplorer
        Dim i As Integer = 1
        Timer1.Enabled = False
        For Each IEx In SWs
                If TypeOf (IEx.Document) Is HTMLDocument Then
                    IE = IEx
                    CurrentDoc = IE.Document
                    CurrentDoc.url = ""
                End If
                i = i + 1
            Catch ex As Exception
            End Try
    End Sub



Code 2:
Imports SHDocVw
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim browser As SHDocVw.InternetExplorer
        Dim myLocalLink As String
        Dim myDoc As mshtml.IHTMLDocument
        Dim shellWindows As SHDocVw.ShellWindows = New SHDocVw.ShellWindows()
        Dim filename As String
        For Each ie As SHDocVw.InternetExplorer In shellWindows
            filename = System.IO.Path.GetFileNameWithoutExtension(ie.FullName).ToLower()
            If filename = "iexplore" Then
                browser = ie
                myDoc = browser.Document
                myLocalLink = myDoc.url
                myDoc.url = ""
            End If
    End Sub

Under both Code 1 and Code 2 is going to move IE's URL.

But.. All tabs navigate to the URL(google).

I want to change the active tab's URL.
Posted 21-Jul-10 3:21am
Updated 21-Jul-10 3:34am
Dalek Dave433.3K
Dalek Dave 21-Jul-10 9:35am
Edited for highlighting code.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

IE now creates a new process for each tab. By traversing all IE's will therefore go by all tabpages.

Maybe this link can help:[^]

And take a look here:[^]

Good luck!
rus204 21-Jul-10 11:29am
ah.. thanks.
but my Code 1 is same thing ` `
I already saw that
E.F. Nijboer 21-Jul-10 12:47pm
And the other link? There is some code using the accessibility api, maybe this could help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171019.1 | Last Updated 1 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100