UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Copy The Current Internet Explorer URL To A Field, Any Versions    
 
   
BuzyG
post Dec 6 2017, 08:42 AM
Post#1



Posts: 340
Joined: 20-September 12
From: Cornwall UK


Hello again folks. I'm hoping this one is straight forward.

I have internet Explorer 11 open and simply need to copy the current URL from the address bar, into a field, [DiscLink], on the current form. The Microsoft Internet controls Library is loaded.

Presently this is what I have, alas it does not work.

CODE
Private Sub btnGetURL_Click()

  Dim IE As SHDocVw.InternetExplorer
  Dim StrURL As String

  StrURL = IE.LocationURL
  Me![DiscLink] = StrURL

End Sub

--------------------
Live to Surf
Go to the top of the page
 
GroverParkGeorge
post Dec 6 2017, 08:52 AM
Post#2


UA Admin
Posts: 31,237
Joined: 20-June 02
From: Newcastle, WA


What does it mean to say it doesn't work? Wrong URL? No URL? Nothing pasted into the table or ?


--------------------
Go to the top of the page
 
DanielPineault
post Dec 6 2017, 09:00 AM
Post#3


UtterAccess VIP
Posts: 5,452
Joined: 30-June 11



Perhaps this could help.

http://www.devhut.net/2017/02/03/internet-...orer-save-tabs/

--------------------
Daniel Pineault (2010-2017 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...
Go to the top of the page
 
BuzyG
post Dec 6 2017, 09:00 AM
Post#4



Posts: 340
Joined: 20-September 12
From: Cornwall UK


A fine question George. Apparently my wishing for it does not make others telepathic.


Object Variable or with Block Variable not set occurs at...

StrURL = IE.LocationURL
This post has been edited by BuzyG: Dec 6 2017, 09:07 AM

--------------------
Live to Surf
Go to the top of the page
 
GroverParkGeorge
post Dec 6 2017, 09:20 AM
Post#5


UA Admin
Posts: 31,237
Joined: 20-June 02
From: Newcastle, WA


Sweet.

--------------------
Go to the top of the page
 
BuzyG
post Dec 6 2017, 11:14 AM
Post#6



Posts: 340
Joined: 20-September 12
From: Cornwall UK


Thanks Daniel notworthy.gif

I just needed to bind to the current instance of IE 11. I had been trying to use the Get Object Method, which I now know doesn't work for IE. Hence why the 'Microsoft Internet Controls' Library needs to be Open.

Final code was...

CODE
Dim SW As SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer
Dim StrURL As String
  
  Set SW = New SHDocVw.ShellWindows
  For Each IE In SW
    If IE.NAME = "Internet Explorer" Then
      StrURL = IE.LocationURL
      Me![DiscLink] = StrURL
    End If
  Next
Set SW = Nothing
Set IE = Nothing

--------------------
Live to Surf
Go to the top of the page
 
DanielPineault
post Dec 6 2017, 01:47 PM
Post#7


UtterAccess VIP
Posts: 5,452
Joined: 30-June 11



thumbup.gif

Yeah, I remember having that issue when I develop my code a while back. Ah, fun times...!

--------------------
Daniel Pineault (2010-2017 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    16th December 2017 - 11:50 AM