PC Review


Reply
Thread Tools Rate Thread

Open Web browser with code

 
 
Lisa B.
Guest
Posts: n/a
 
      4th Aug 2003
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.


 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      4th Aug 2003
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." <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
Guest
Posts: n/a
 
      4th Aug 2003
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:%(E-Mail Removed)...
> 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." <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > 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.
> >
> >

>
>



 
Reply With Quote
 
Guest
Posts: n/a
 
      4th Aug 2003
Here's another approach:

www.mvps.org/access/modules/mdl0062.htm

Steve


<SteveT> wrote in message news:%(E-Mail Removed)...
> 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." <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > 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.
> >
> >

>
>



 
Reply With Quote
 
Tim Ferguson
Guest
Posts: n/a
 
      4th Aug 2003
<SteveT> wrote in news:(E-Mail Removed):

>
> 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

 
Reply With Quote
 
Lisa B.
Guest
Posts: n/a
 
      4th Aug 2003
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:(E-Mail Removed)...
> 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:%(E-Mail Removed)...
> > 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." <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > 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.
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Guest
Posts: n/a
 
      4th Aug 2003

Try:

Shell "C:\Program Files\Internet Explorer\iexplore.exe " & URLAddress
,vbMaximizedFocus



"Lisa B." <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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:(E-Mail Removed)...
> > 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:%(E-Mail Removed)...
> > > 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." <(E-Mail Removed)> wrote in message
> > > news:%(E-Mail Removed)...
> > > > 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.
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Lisa B.
Guest
Posts: n/a
 
      4th Aug 2003
This works, Thank You.

<SteveT> wrote in message news:(E-Mail Removed)...
>
> Try:
>
> Shell "C:\Program Files\Internet Explorer\iexplore.exe " & URLAddress
> ,vbMaximizedFocus
>
>
>
> "Lisa B." <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > 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:(E-Mail Removed)...
> > > 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:%(E-Mail Removed)...
> > > > 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." <(E-Mail Removed)> wrote in message
> > > > news:%(E-Mail Removed)...
> > > > > 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.
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code does not work when file open directly in browser ashish.kare@gmail.com Microsoft Excel Discussion 1 1st Oct 2007 01:44 PM
Open .msg / .eml file in Browser/placeholder within browser ai4u Microsoft ASP .NET 0 27th Apr 2006 01:29 PM
Open .msg / .eml file in Browser/placeholder within browser ai4u Microsoft Outlook VBA Programming 0 27th Apr 2006 12:05 PM
Can I open a ppt file in a browser, without the browser repeatedly asking for confirmation? chillynois@yahoo.com Microsoft Powerpoint 0 15th Mar 2006 02:28 PM
how to open a new browser windows using asp.net code? David Microsoft ASP .NET 5 3rd Dec 2004 04:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:11 PM.