Solved

control caption/title in Internet Explorer

Posted on 2006-10-19
5
176 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
[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
5 Comments
 
LVL 28

Accepted Solution

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

Expert Comment

by:siddhant3s
ID: 17798383
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

733 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