Consulting

Results 1 to 4 of 4

Thread: userform textbox save file path in cell as hyperlink

  1. #1

    userform textbox save file path in cell as hyperlink

    Hi there,

    Hopefully someone can help me, since recently I am working on VBA and have been looking for a solution for saving a hyperlink for a week.
    I will explain what I am doing, I have created a user form where a file from the server is stored in a text box using a file path.
    When I save the userform then all data is sent correctly to my data base. but unfortunately the file path is not recognized as a hyperlink but as text value.
    My question is actually how can i save my file path as a hyperlink in my excel file in one way?

    I use this code to browse to my file:
    Private Sub CmdFoto_Click()
    
     'BROWSE FOR FILE
     
       Dim FileName As String
       
         FileName = Application.GetOpenFilename()
         txtFoto.Value = FileName
         txtFoto.SetFocus
         
    End Sub
    For save the hyperlink to my excel file in column "k" I use this:

    .Range("K" & iRow).Value = frmNew.txtFoto.Value

  2. #2
    VBAX Mentor
    Joined
    Dec 2008
    Posts
    404
    Location
     .Hyperlinks.Add Anchor:=.Range("K" & iRow), _ 
                            Address:=frmNew.txtFoto.Value, _ 
                            TextToDisplay:=frmNew.txtFoto.Value '(Or Blah, blah, blah ;))
    Artik

  3. #3
    Quote Originally Posted by Artik View Post
     .Hyperlinks.Add Anchor:=.Range("K" & iRow), _ 
                            Address:=frmNew.txtFoto.Value, _ 
                            TextToDisplay:=frmNew.txtFoto.Value '(Or Blah, blah, blah ;))
    Artik

    Thanks a lot, it works!

  4. #4
    Quote Originally Posted by remco77a View Post
    Thanks a lot, it works!
    I'm do some testings, and didn't Change the code but I get a error 5 code, of this code, after I try to save the value.
    What could that be?

Posting Permissions

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