?
Solved

control caption/title in Internet Explorer

Posted on 2006-10-19
5
Medium Priority
?
181 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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 2 hours left to enroll

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