Solved

control caption/title in Internet Explorer

Posted on 2006-10-19
5
167 Views
Last Modified: 2008-02-01
I'm using the following code to open a web browers.  How do I set the caption?

Set objIE = New InternetExplorer

With objIE
   
    .Navigate strURL & "?docs=" & NRTID & "&library=" & NRTLibrary
    .Visible = True
    .StatusBar = False
    .Toolbar = False
    .Width = 630
    .Height = 400
'    .Left = 1158
    .Resizable = False
   
End With
0
Comment
Question by:eshurak
5 Comments
 
LVL 27

Accepted Solution

by:
Ark earned 500 total points
Comment Utility
  While objIE.readyState < 4
      DoEvents
   Wend
   objIE.document.Title = "blahblah"
0
 
LVL 1

Expert Comment

by:siddhant3s
Comment Utility
Hello eshurak,

Do you know what is the defalt caption of the Page??

I mean, do you know what will be the the Caption of the Internet Explorer.

If yes, I can help you......

The following code will change the caption of the Internet Explorer(or Any other window) if you know what is the Current caption of the Window(like internet Explorer).

Actually, what this program do is that it searches the window with the caption u enter and then when the window is found, it changes its caption to the one you want.

'''''''''''''''''''''''''''THIS IS THE CODE'''''''''''''''''''''''''''''''''''''
''''''''''''''YOU SHOULD HAVE A COMMAND BUTTON NAMED AS COMMAND1'''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Option Explicit
Private Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam _
As Long, lParam As Any) As Long
Private Const WM_SETTEXT = &HC
Private Sub Command1_Click()
Dim target_hwnd As Long
Dim target_name As String
Dim new_caption As String

'''''''''''''''''''''''''''''''''''''IMPORTANT''''''IMPORTANT''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' You should enter the orignal caption of the Internet Explorer here.

target_name = "Google - Microsoft Internet Explorer"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

target_hwnd = FindWindow(vbNullString, target_name)

If target_hwnd = 0 Then
MsgBox "Cannot find target"
Exit Sub
End If


'''''''''''''''''''''''''''''''''''''IMPORTANT''''''IMPORTANT''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'This should be the New Caption you want to have....
new_caption = "I have changed the Caption..."
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

SendMessage target_hwnd, WM_SETTEXT, 0, ByVal new_caption
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''





I hope this resolve the issue.
Thank You
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
using Access 8 52
Determine Range to Select 5 33
How to debug this code 7 49
How does CurrentUser work? 10 25
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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 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…

771 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

14 Experts available now in Live!

Get 1:1 Help Now