Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open Web Browser from Button (2000)

    Is there a way of opening the default web browser from a command button, the page to be viewed determined by the contents of a text box? I've tried to use the hyperlink data type but it is a real pain to edit a hyperlink field once something is in there. You can't left click to get in to the field as this opens a web browser, even if you click in a space where there is no text. You have to right click and wade through some quite confusing menus, made more confusing because you are confronted by two versions of the URL, one for the browser to use and one for Access to display on the form. I don't think the users I am aiming at will be very happy with that sustem.

    What I'd prefer is a command button that opens the machine's default browser at the page specified in an adjacent, easy to edit, rext box.
    I see that there is a Microsoft Web Browser control available when I click the More Controls button on the Toolbox, but I am wary of using it in case it does not exist on the user's machine.

    Ian

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Open Web Browser from Button (2000)

    Say that you have a text box txtWebAddress and a command button cmdBrowse. The On Click event procedure for the command button could look like this:

    Private Sub cmdBrowse_Click()
    Application.FollowHyperlink Address:=Me.txtWebAddress
    End Sub

    If you type FollowHyperlink in the VB Editor and press F1, you'll get online help about this method.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •