I am working with the Internet Explorer object in Visual Basic. Is there a way to copy the current URL IE is displaying so I can paste it elsewhere with my clipboard?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming you already have the IE window identified, which itself is a little more complicated – I can elaborate on this if needed:
To get the IE window, you’ll need to reference the
Microsoft Internet Controlslibrary (ieframe.dll) in the VBA editor by going toTools=>References...and selecting it from the list. If that item is not available, the .dll file for me is located atC:\Windows\System32\ieframe.dll.Once the reference is set, you’ll have access to the so-called
SHDocVwlibrary in your code.You can grab the IE window (assuming only one open) using the following (untested, modified/reduced from my own working code):
The above can also be modified to allow for a selection of multiple open IE windows.