Solved

control caption/title in Internet Explorer

Posted on 2006-10-19
5
178 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

705 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