Results 1 to 6 of 6

Thread: Commend button to pen an internet browser.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2021
    Posts
    25

    Commend button to pen an internet browser.

    Hi.

    While developing a web browser I created a command that open an internet window in Explorer.
    Now, How can we add a command button to open Google Chrome instead of Internet Explorer?

    Tks

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,906

    Re: Commend button to pen an internet browser.

    Shell "Chrome.exe"

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Commend button to pen an internet browser.

    There is no such thing as an "internet window." I think you are trying to say something more like "web page."

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Dec 2021
    Posts
    25

    Re: Commend button to pen an internet browser.

    Hi.

    I am not so familiar with this action. I am kind of new on this. Can you be more clear?

    So in the command1 button what code shall I write so the web page opens in Chrome instead of Explorer?

    Tks.

  5. #5
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,906

    Re: Commend button to pen an internet browser.

    What do you use at the moment to show a webpage?

  6. #6
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,477

    Re: Commend button to pen an internet browser.

    Quote Originally Posted by Ricardonlc View Post
    Hi.

    While developing a web browser I created a command that open an internet window in Explorer.
    Now, How can we add a command button to open Google Chrome instead of Internet Explorer?

    Tks
    Maybe this will help. I have used this routine for years to read an HTML encoded file in my default browser.

    J.A. Coutts
    Code:
    Private Sub cmdHTML_Click()
        Dim TempPath As String
        Dim TempFile As String
        Dim strBrowser As String
        Dim TmpFile%
        Dim lStart As Long
        Dim lEnd As Long
        Dim RetVal As Long
        'Find HTML portion of message
        If InStr(1, strContent, "text/html", 1) > 0 Then 'HTML only
            lStart = 1
            lEnd = Len(MessageBuffer)
        Else 'MultiPart
            lStart = InStr(1, MessageBuffer, "text/html", 1)
            If lStart > 0 Then
                lStart = InStr(lStart, MessageBuffer, vbCrLf & vbCrLf) + 4
                lEnd = InStr(lStart, MessageBuffer, strBoundary)
            End If
        End If
        If lStart = 0 Then
            MsgBox "HTML code not found in current message!", vbExclamation
            Exit Sub
        End If
        If lEnd = 0 Then lEnd = Len(MessageBuffer)
        TempPath = GetTmpPath
        ID = Mid$(Me.Caption, 14)
        TempFile = "jac" & ID & ".htm"
        TmpFile% = OpenFile(TempPath & TempFile, 1, 0, 512)
        If TmpFile% = 0 Then
            MsgBox "File Error with " & TempFile, 16, "ABORT PROCEDURE"
            Exit Sub
        End If
        Print #TmpFile%, Mid$(MessageBuffer, lStart, lEnd - lStart)
        Close TmpFile%
        If Len(TempPath) Then
            RetVal = ShellExecute(0&, "open", TempPath & TempFile, 0, 0, 1)
        End If
    End Sub

Posting Permissions

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



Click Here to Expand Forum to Full Width