ID: Q178879
The information in this article applies to:
In versions of Microsoft Internet Explorer earlier than Microsoft Internet Explorer version 4.x, dynamic data exchange (DDE) commands could be used to extract the Uniform Resource Locator (URL) address from the browser. For instance, the following sample Microsoft Visual Basic for Applications code would display the URL address in a message box:
Sub ShowUrl()
IEchannel = DDEInitiate("iexplore", "www_getwindowinfo")
Info = DDERequest(IEchannel, "dogetwindowinfo")
MsgBox Info
DDETerminateAll
End Sub
This code no longer works with Microsoft Internet Explorer version 4.x and
returns the following error message:
Run-time error '4599': Process failed in other application
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/refguide/
The following sample Visual Basic code displays the URL address for each
window displayed in the Microsoft Internet Explorer browser:
Sub FindIE40Url()
Dim IEWindows As New SHDocVw.ShellWindows
Dim oIE As SHDocVw.InternetExplorer
On Error GoTo errorhandler
For Each oIE In IEWindows
MsgBox "Caption: " & oIE.LocationName & vbCr & "URL: " _
& oIE.LocationURL
Next
errorhandler:
If Err <> 0 then
MsgBox " Microsoft Internet Explorer must be running" _
& " for this code to work."
End If
End Sub
Note: For this code to work, you must reference the "Microsoft Internet
Controls." To add the "Microsoft Internet Controls" reference, follow these
steps:
1. In the Visual Basic Editor, click References on the Tools menu.
The References dialog box shows all object libraries and projects that
are registered with the operating system.
2. In the Available References list, scroll down to find "Microsoft
Internet Controls."
3. Click to select the "Microsoft Internet Controls" check box, and then
click OK.
For more information about the Microsoft Internet Explorer 3.x Automation object, please see the "Web Browse Objects" documentation available at the following Microsoft World Wide Web site:
http://www.microsoft.com/intdev/sdk
NOTE: Because the Microsoft Web site is constantly updated, the site
address may change without notice. If this occurs, link to the Microsoft
home page at the following address:
http://www.microsoft.com/
You can also obtain information about the Microsoft Internet Explorer 3.x
Automation object by searching on "InternetExplorer Object" in the ActiveX
SDK online documentation.
For Microsoft Internet Explorer 4.x, refer to the "Reusing the WebBrowser Control" in the "Internet Tools and Technologies" book of the Internet Client SDK documentation, or search on "InternetExplorer" in the Internet Client SDK documents index.
The Internet Client Software Development Kit (SDK) provides the necessary tools, samples, and documentation for authoring content for the Web and the desktop, for developing controls and components, and for writing applications for the Internet. This SDK also allows you to take advantage of technology provided by Microsoft Internet Explorer version 4.x.
For more information about the Internet Client SDK, please see the following Microsoft World Wide Web sites:
http://www.microsoft.com/msdn/sdk/
-and-
http://www.microsoft.com/intdev/sdk/
NOTE: Because the Microsoft Web site is constantly updated, the site
address may change without notice. If this occurs, link to the Microsoft
home page at the following address:
http://www.microsoft.com/
For more information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q163435
TITLE : VBA: Programming Resources for Visual Basic for
Applications
Additional query words: wordcon vba
Keywords : kbcode kbprg kbwordvba IntpDde
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: April 5, 1999