Web Brouser

Discussion in 'AutoCAD' started by Kumar, Feb 16, 2004.

  1. Kumar

    Kumar Guest

    Hi everybody,
    I want to open a a perticular web site from command button in Interface developed using VBA.I am doing this using send command method and running browser command by clicking on command button. It has two problem-
    1.When particular site, i have to hide my interface which i don't want to hide and want to open web site in new window.
    2. It open particular web site two times.

    Code which I am using is given below-

    Private Sub CommandButton3_Click()
    'UserForm2.Enabled = False
    Dim preferences As AcadPreferences
    Dim currDefaultInternetURL As String
    Dim newDefaultInternetURL As String
    UserForm2.hide
    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current DefaultInternetURL value
    currDefaultInternetURL = preferences.Files.DefaultInternetURL

    ' Change the value for DefaultInternetURL
    newDefaultInternetURL = "www.spin.gov.ab.ca"
    preferences.Files.DefaultInternetURL = newDefaultInternetURL
    ThisDrawing.SendCommand "_Browser"
    End Sub

    Does any body have suggestions to this or have another method to do so, pls let me know.
     
    Kumar, Feb 16, 2004
    #1
  2. Kumar

    Mark Olsen Guest

    What about using a WebBrowser control in your form?
    Every machine that uses it would have to have IE installed, but if that's
    not a problem then...
    You would have to make sure you have a reference to "Microsoft Internet
    Controls"
    Add the "Microsoft Web Browser" tool to your form and then try the following
    code.

    Private Sub UserForm_Activate()
    WebBrowser1.Navigate "http://www.spin.gov.ab.ca"
    End Sub

    developed using VBA.I am doing this using send command method and running
    browser command by clicking on command button. It has two problem-
    hide and want to open web site in new window.
    pls let me know.
     
    Mark Olsen, Feb 18, 2004
    #2
  3. Kumar

    Ed Jobe Guest

    Here's a function I wrote to avoid using SendCommand.

    Public Sub Browse(Optional URL As String, Optional winstyle As
    VbAppWinStyle)
    'opens IE in last WinStyle if WinStyle is not supplied

    'Nav to home page if url is blank
    If Not URL = "" Then URL = " " & URL
    'make sure your path to IE is correct
    Shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE" & URL, winstyle
    End Sub

    --
    --
    Ed
    --
    developed using VBA.I am doing this using send command method and running
    browser command by clicking on command button. It has two problem-
    hide and want to open web site in new window.
    pls let me know.
     
    Ed Jobe, Feb 18, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.