+ Reply to Thread
Results 1 to 6 of 6

Help to open a web page from a textbox

Hybrid View

  1. #1
    Registered User
    Join Date
    01-18-2015
    Location
    chile
    MS-Off Ver
    2010
    Posts
    12

    Post Help to open a web page from a textbox

    hello everyone:

    Thanks for read my post.

    I'm from Chile, i need your help.

    Does anyone know how open the website saved from the textbox?

    Is there a code for that?

    II hope for his kind answers

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Help to open a web page from a textbox

    Not sure what you mean by "saved from the text box". But you could adapt something like this:

    Sub foo()
        Dim stURL As String
        On Error GoTo Terminate
        stURL = InputBox("Enter URL")
        If Not Left(stURL, 4) = "http" Then stURL = "http://" & stURL
        ThisWorkbook.FollowHyperlink (stURL)
    Terminate:
        If Err.Number Then
            MsgBox "Error " & Err.Number & " - " & Err.Description, _
                vbCritical + vbOKOnly, "Error"
            Err.Clear
        End If
    End Sub
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    01-18-2015
    Location
    chile
    MS-Off Ver
    2010
    Posts
    12

    Re: Help to open a web page from a textbox

    Quote Originally Posted by Olly View Post
    Not sure what you mean by "saved from the text box". But you could adapt something like this:

    Sub foo()
        Dim stURL As String
        On Error GoTo Terminate
        stURL = InputBox("Enter URL")
        If Not Left(stURL, 4) = "http" Then stURL = "http://" & stURL
        ThisWorkbook.FollowHyperlink (stURL)
    Terminate:
        If Err.Number Then
            MsgBox "Error " & Err.Number & " - " & Err.Description, _
                vbCritical + vbOKOnly, "Error"
            Err.Clear
        End If
    End Sub
    Thanks Olly.

    when i refer to "saved from the text box" is can obtain the link that is found in a specific cells in a woorksheets. Then my idea is ejecute the userform and the user can open the link directly from textbox.

    Know what I mean?

    i hope your answer, thanks in advance

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Help to open a web page from a textbox

    Post a sample workbook, showing your input cell(s) and existing userform / code.

  5. #5
    Registered User
    Join Date
    01-18-2015
    Location
    chile
    MS-Off Ver
    2010
    Posts
    12

    Re: Help to open a web page from a textbox

    Quote Originally Posted by Olly View Post
    Post a sample workbook, showing your input cell(s) and existing userform / code.
    Hello Olly

    Look, please attach the file relating to example need if you can help me. Basically i want to know if there some methods for open the link that found in the textbox.




    Best RegardExample.xlsm

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Help to open a web page from a textbox

    Try this:
    Private Sub CommandButton1_Click()
        Dim stURL As String
        On Error GoTo Terminate
        stURL = TextBox4.Value
        If Not Left(stURL, 4) = "http" Then stURL = "http://" & stURL
        ThisWorkbook.FollowHyperlink (stURL)
    Terminate:
        If Err.Number Then
            MsgBox "Error " & Err.Number & " - " & Err.Description, _
                vbCritical + vbOKOnly, "URL Error"
            Err.Clear
        End If
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copy auto insert page number and paste to a textbox on same page
    By thadacto in forum Word Formatting & General
    Replies: 3
    Last Post: 03-26-2013, 07:37 AM
  2. Autofill TextBox on each page of Multipage Userform
    By kimmcms in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-20-2013, 06:45 PM
  3. Replies: 14
    Last Post: 08-17-2012, 10:54 AM
  4. Replies: 4
    Last Post: 10-12-2010, 08:36 AM
  5. [SOLVED] when i open a excel doc , it open muiltple page not related?
    By greyshark001 in forum Excel General
    Replies: 1
    Last Post: 10-18-2005, 01:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1