PC Review
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Open Web browser with code
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Open Web browser with code
![]() |
Open Web browser with code |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Does anyone know the code to open the web browser and go to a URL listed in
a field. I know I can do it if I make the field a hyperlink, but the field is on a sub form and will be invisible to the user. |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Lisa,
Using the Microsoft Web Browser object, in the click event of a button, the following works: Dim ctl As Object Dim var As Long Set ctl = Me.ctlWebBrowser.Object ctl.Navigate ("www.google.com") While you're at it, you can test for and use the Updated event and run code if required: Private Sub ctlWebBrowser_Updated(Code As Integer) Me.Command1.Visible = True Me.Command1.SetFocus End Sub Use the Object Browser to inspect all the events and properties. Steve "Lisa B." <lbagley@MayaTech.com> wrote in message news:%23U2iIRqWDHA.2476@tk2msftngp13.phx.gbl... > Does anyone know the code to open the web browser and go to a URL listed in > a field. > > I know I can do it if I make the field a hyperlink, but the field is on a > sub form and will be invisible to the user. > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Occurs to me I may have missed your question. I was thinking of the browser
object inserted on a form... In code this works to start IE and go to 'www.msn.com': Shell "C:\Program Files\Internet Explorer\iexplore.exe www.msn.com" Steve <SteveT> wrote in message news:%23JC8daqWDHA.1680@tk2msftngp13.phx.gbl... > Lisa, > > Using the Microsoft Web Browser object, in the click event of a button, the > following works: > > > Dim ctl As Object > Dim var As Long > > Set ctl = Me.ctlWebBrowser.Object > > ctl.Navigate ("www.google.com") > > > While you're at it, you can test for and use the Updated event and run code > if required: > > Private Sub ctlWebBrowser_Updated(Code As Integer) > Me.Command1.Visible = True > Me.Command1.SetFocus > End Sub > > Use the Object Browser to inspect all the events and properties. > > Steve > > > > "Lisa B." <lbagley@MayaTech.com> wrote in message > news:%23U2iIRqWDHA.2476@tk2msftngp13.phx.gbl... > > Does anyone know the code to open the web browser and go to a URL listed > in > > a field. > > > > I know I can do it if I make the field a hyperlink, but the field is on a > > sub form and will be invisible to the user. > > > > > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Here's another approach:
www.mvps.org/access/modules/mdl0062.htm Steve <SteveT> wrote in message news:%23JC8daqWDHA.1680@tk2msftngp13.phx.gbl... > Lisa, > > Using the Microsoft Web Browser object, in the click event of a button, the > following works: > > > Dim ctl As Object > Dim var As Long > > Set ctl = Me.ctlWebBrowser.Object > > ctl.Navigate ("www.google.com") > > > While you're at it, you can test for and use the Updated event and run code > if required: > > Private Sub ctlWebBrowser_Updated(Code As Integer) > Me.Command1.Visible = True > Me.Command1.SetFocus > End Sub > > Use the Object Browser to inspect all the events and properties. > > Steve > > > > "Lisa B." <lbagley@MayaTech.com> wrote in message > news:%23U2iIRqWDHA.2476@tk2msftngp13.phx.gbl... > > Does anyone know the code to open the web browser and go to a URL listed > in > > a field. > > > > I know I can do it if I make the field a hyperlink, but the field is on a > > sub form and will be invisible to the user. > > > > > > |
|
|
|
#5 |
|
Guest
Posts: n/a
|
<SteveT> wrote in news:eb5MbgqWDHA.2360@TK2MSFTNGP12.phx.gbl:
> > Shell "C:\Program Files\Internet Explorer\iexplore.exe www.msn.com" > > Curious -- putting a well formed URI into the Start Programs/ Run box like this works as expected:- http://www.helios.com but using the same thing as a shell command results in a file not found error. ? shell( "http://www.helios.com" ) So what is the correct procedure for calling the _default_ browser without having to hard-code the path and executable? Tim F |
|
|
|
#6 |
|
Guest
Posts: n/a
|
OK, that works. However when IE opens it is minimized to the startbar. Is
there a way to have it open as the active window? Now, I have this code behind a button ---------------------------------------------------------------- Dim URLAddress As String GL_Address = Forms![frmRecruitment]![frmAppointment].Form![frmAppointmentLocation].Form![ Address] GL_City = Forms![frmRecruitment]![frmAppointment].Form![frmAppointmentLocation].Form![ City] GL_State = Me![frmAppointmentLocation].Form![StateID] GL_Zip = Me![frmAppointmentLocation].Form![Zip] MapAddress = ChangeStr(GL_Address, Chr$(32), Chr$(43), 0) MapCity = ChangeStr(GL_City, Chr$(32), Chr$(43), 0) URLAddress = "http://www.mapquest.com/maps/map.adp?country=US&addtohistory=&address=" + MapAddress + "state=" + GL_State + "&zipcode=" + GL_Zip + "&homesubmit=Get+Map" Shell "C:\Program Files\Internet Explorer\iexplore.exe " & URLAddress -------------------------------------------------------------------------- This opens IE to mapquest and finds an address <SteveT> wrote in message news:eb5MbgqWDHA.2360@TK2MSFTNGP12.phx.gbl... > Occurs to me I may have missed your question. I was thinking of the browser > object inserted on a form... > > In code this works to start IE and go to 'www.msn.com': > > Shell "C:\Program Files\Internet Explorer\iexplore.exe www.msn.com" > > Steve > > <SteveT> wrote in message news:%23JC8daqWDHA.1680@tk2msftngp13.phx.gbl... > > Lisa, > > > > Using the Microsoft Web Browser object, in the click event of a button, > the > > following works: > > > > > > Dim ctl As Object > > Dim var As Long > > > > Set ctl = Me.ctlWebBrowser.Object > > > > ctl.Navigate ("www.google.com") > > > > > > While you're at it, you can test for and use the Updated event and run > code > > if required: > > > > Private Sub ctlWebBrowser_Updated(Code As Integer) > > Me.Command1.Visible = True > > Me.Command1.SetFocus > > End Sub > > > > Use the Object Browser to inspect all the events and properties. > > > > Steve > > > > > > > > "Lisa B." <lbagley@MayaTech.com> wrote in message > > news:%23U2iIRqWDHA.2476@tk2msftngp13.phx.gbl... > > > Does anyone know the code to open the web browser and go to a URL listed > > in > > > a field. > > > > > > I know I can do it if I make the field a hyperlink, but the field is on > a > > > sub form and will be invisible to the user. > > > > > > > > > > > > |
|
|
|
#7 |
|
Guest
Posts: n/a
|
Try: Shell "C:\Program Files\Internet Explorer\iexplore.exe " & URLAddress ,vbMaximizedFocus "Lisa B." <lbagley@MayaTech.com> wrote in message news:%231mpJDrWDHA.1736@TK2MSFTNGP10.phx.gbl... > OK, that works. However when IE opens it is minimized to the startbar. Is > there a way to have it open as the active window? > > Now, I have this code behind a button > ---------------------------------------------------------------- > Dim URLAddress As String > > GL_Address = > Forms![frmRecruitment]![frmAppointment].Form![frmAppointmentLocation].Form![ > Address] > GL_City = > Forms![frmRecruitment]![frmAppointment].Form![frmAppointmentLocation].Form![ > City] > GL_State = Me![frmAppointmentLocation].Form![StateID] > GL_Zip = Me![frmAppointmentLocation].Form![Zip] > > MapAddress = ChangeStr(GL_Address, Chr$(32), Chr$(43), 0) > MapCity = ChangeStr(GL_City, Chr$(32), Chr$(43), 0) > > URLAddress = > "http://www.mapquest.com/maps/map.adp?country=US&addtohistory=&address=" + > MapAddress + "state=" + GL_State + "&zipcode=" + GL_Zip + > "&homesubmit=Get+Map" > > Shell "C:\Program Files\Internet Explorer\iexplore.exe " & URLAddress > -------------------------------------------------------------------------- > > This opens IE to mapquest and finds an address > > > > > > > <SteveT> wrote in message news:eb5MbgqWDHA.2360@TK2MSFTNGP12.phx.gbl... > > Occurs to me I may have missed your question. I was thinking of the > browser > > object inserted on a form... > > > > In code this works to start IE and go to 'www.msn.com': > > > > Shell "C:\Program Files\Internet Explorer\iexplore.exe www.msn.com" > > > > Steve > > > > <SteveT> wrote in message news:%23JC8daqWDHA.1680@tk2msftngp13.phx.gbl... > > > Lisa, > > > > > > Using the Microsoft Web Browser object, in the click event of a button, > > the > > > following works: > > > > > > > > > Dim ctl As Object > > > Dim var As Long > > > > > > Set ctl = Me.ctlWebBrowser.Object > > > > > > ctl.Navigate ("www.google.com") > > > > > > > > > While you're at it, you can test for and use the Updated event and run > > code > > > if required: > > > > > > Private Sub ctlWebBrowser_Updated(Code As Integer) > > > Me.Command1.Visible = True > > > Me.Command1.SetFocus > > > End Sub > > > > > > Use the Object Browser to inspect all the events and properties. > > > > > > Steve > > > > > > > > > > > > "Lisa B." <lbagley@MayaTech.com> wrote in message > > > news:%23U2iIRqWDHA.2476@tk2msftngp13.phx.gbl... > > > > Does anyone know the code to open the web browser and go to a URL > listed > > > in > > > > a field. > > > > > > > > I know I can do it if I make the field a hyperlink, but the field is > on > > a > > > > sub form and will be invisible to the user. > > > > > > > > > > > > > > > > > > > > |
|
|
|
#8 |
|
Guest
Posts: n/a
|
This works, Thank You.
<SteveT> wrote in message news:uQzr6AsWDHA.1640@TK2MSFTNGP10.phx.gbl... > > Try: > > Shell "C:\Program Files\Internet Explorer\iexplore.exe " & URLAddress > ,vbMaximizedFocus > > > > "Lisa B." <lbagley@MayaTech.com> wrote in message > news:%231mpJDrWDHA.1736@TK2MSFTNGP10.phx.gbl... > > OK, that works. However when IE opens it is minimized to the startbar. > Is > > there a way to have it open as the active window? > > > > Now, I have this code behind a button > > ---------------------------------------------------------------- > > Dim URLAddress As String > > > > GL_Address = > > > Forms![frmRecruitment]![frmAppointment].Form![frmAppointmentLocation].Form![ > > Address] > > GL_City = > > > Forms![frmRecruitment]![frmAppointment].Form![frmAppointmentLocation].Form![ > > City] > > GL_State = Me![frmAppointmentLocation].Form![StateID] > > GL_Zip = Me![frmAppointmentLocation].Form![Zip] > > > > MapAddress = ChangeStr(GL_Address, Chr$(32), Chr$(43), 0) > > MapCity = ChangeStr(GL_City, Chr$(32), Chr$(43), 0) > > > > URLAddress = > > "http://www.mapquest.com/maps/map.adp?country=US&addtohistory=&address=" + > > MapAddress + "state=" + GL_State + "&zipcode=" + GL_Zip + > > "&homesubmit=Get+Map" > > > > Shell "C:\Program Files\Internet Explorer\iexplore.exe " & URLAddress > > -------------------------------------------------------------------------- > > > > This opens IE to mapquest and finds an address > > > > > > > > > > > > > > <SteveT> wrote in message news:eb5MbgqWDHA.2360@TK2MSFTNGP12.phx.gbl... > > > Occurs to me I may have missed your question. I was thinking of the > > browser > > > object inserted on a form... > > > > > > In code this works to start IE and go to 'www.msn.com': > > > > > > Shell "C:\Program Files\Internet Explorer\iexplore.exe www.msn.com" > > > > > > Steve > > > > > > <SteveT> wrote in message > news:%23JC8daqWDHA.1680@tk2msftngp13.phx.gbl... > > > > Lisa, > > > > > > > > Using the Microsoft Web Browser object, in the click event of a > button, > > > the > > > > following works: > > > > > > > > > > > > Dim ctl As Object > > > > Dim var As Long > > > > > > > > Set ctl = Me.ctlWebBrowser.Object > > > > > > > > ctl.Navigate ("www.google.com") > > > > > > > > > > > > While you're at it, you can test for and use the Updated event and run > > > code > > > > if required: > > > > > > > > Private Sub ctlWebBrowser_Updated(Code As Integer) > > > > Me.Command1.Visible = True > > > > Me.Command1.SetFocus > > > > End Sub > > > > > > > > Use the Object Browser to inspect all the events and properties. > > > > > > > > Steve > > > > > > > > > > > > > > > > "Lisa B." <lbagley@MayaTech.com> wrote in message > > > > news:%23U2iIRqWDHA.2476@tk2msftngp13.phx.gbl... > > > > > Does anyone know the code to open the web browser and go to a URL > > listed > > > > in > > > > > a field. > > > > > > > > > > I know I can do it if I make the field a hyperlink, but the field is > > on > > > a > > > > > sub form and will be invisible to the user. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

