+ Reply to Thread
Results 1 to 13 of 13

Excel VBA in a userform that create a hyperlink into a specific cell location

  1. #1
    Registered User
    Join Date
    10-30-2012
    Location
    Milwaukee
    MS-Off Ver
    Excel 2010
    Posts
    8

    Excel VBA in a userform that create a hyperlink into a specific cell location

    Knowledgeable Excel Macro Users,

    'The issue'
    I've been stuck on this problem for about a month now. I created a database in excel that stores multiple parts with 7 columns for part #, description, date, etc. I have 2 userforms, where 1 adds new parts into the database and the other searches the database and displays detailed results of all 7 columns. I now want to create 1 additional userform to allow me to add a hyperlink (location on the drive) into an existing row of data in the database.

    'What i'm looking to do'
    I would like to search one column "Column A" by a text box for part numbers. Then have the option to add a link to a picture location inside the same row of the part searched (Column H) on the database. The hyperlink will be a file location on the drive. Is this a possible solution or is there a better way?

    'Thoughts'
    I'd create a text box inside a userform.
    Link the text box to search column A for match.
    Once item is found allow access to a computer folder search.
    Select a path to pictures location.
    Excel macro then implements the location of the picture into a hyperlink inside the excel database.
    The End..

    I've tried a few different approaches, but i've run into some issues along the way for each attemp.
    Does anyone have any ideas to help start me in the right direction??

    Thanks,
    Mike
    Last edited by mikeflatley01; 12-27-2012 at 07:08 PM. Reason: More Description

  2. #2
    Registered User
    Join Date
    10-30-2012
    Location
    Milwaukee
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Excel VBA in a userform that create a hyperlink into a specific cell location

    So this is what I have so far. I'm having a compiling issue when trying enter the hyperlink. Does anyone have any Ideas????

    Please Login or Register  to view this content.
    Last edited by mikeflatley01; 01-18-2013 at 12:57 PM.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel VBA in a userform that create a hyperlink into a specific cell location

    Mike

    Please add code tags - that code is pretty hard to read, I can't even find the it where you try to add the hyperlink.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    10-30-2012
    Location
    Milwaukee
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Excel VBA in a userform that create a hyperlink into a specific cell location

    I guess to get the full scale I'll release my project. I just want to get help with the hyperlink inside the code for the update mount. Everything else seems to work properly.


    Thanks
    Mike
    Attached Files Attached Files
    Last edited by mikeflatley01; 01-18-2013 at 01:20 PM.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel VBA in a userform that create a hyperlink into a specific cell location

    Mike

    What's happening here?

    You seem to have 2 subs within the sub for the commandbuton click event
    Please Login or Register  to view this content.
    Where is the code for adding a hyperlink?

  6. #6
    Registered User
    Join Date
    10-30-2012
    Location
    Milwaukee
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Excel VBA in a userform that create a hyperlink into a specific cell location

    Thats kinda what I'm struggling with. I have multiple Revs of this database and I've tried a few different things. The GetOpenFilename command works properly inside of Module 3 under Select_A_File, but it doesn't store the path that I've located. So what I would like to do is have it store a specific file path into that userform text box labeled picture link. Then from there it should save into the database. So the coding inside of the command button isn't right. I've been reading through this VBA book, but no luck yet.
    Any Ideas?



    Thanks,
    Mike

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel VBA in a userform that create a hyperlink into a specific cell location

    Mike

    You could put the filename directly in the textbox from Select_A_File.

    Which textbox on which userfom is it supposed to go in?

    By the way, as soon as I open the file I get a message 'Can't find project or library'.

    When I look under Tools>References... it as this.

    MISSING: FUNCRES.XLAM

    Are you using, or have you used it in this file previously, FUNCRES.XLAM?

  8. #8
    Registered User
    Join Date
    10-30-2012
    Location
    Milwaukee
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Excel VBA in a userform that create a hyperlink into a specific cell location

    I do have a VBAProject (funcres.xlam) but i wasn't aware that it was being used by this. I don't think it should have any impact on the this project. The only thing in that project under Modules which was a labeled RibbonX_Code.

    Please Login or Register  to view this content.
    To answer your question I would like to address the coding in Forms "viewrecord" on my doc. In the coding there is Sub Select_A_File(). This should be under CommandButton2_Click(). I think on the copy i posted its probably a little messy where I have a few other things entered in there where i was trying to get to work, but unlikely to succeed.
    Please Login or Register  to view this content.
    My goal is to be able to go back and edit specific cells in the data and add some recent pictures, there file directory (jpg) to correspond to the item. I would like to use CommandButton2_Click to allow me to search for the image (jpeg) and once selected have that directory saved into "txtpic1". But I was wondering if i could make that directory into a Hyperlink. This way if i search for the item on the frmSearchDatabase I could click on the images hyperlink and then i would bring up the picture. I know this is a lot to ask for or maybe not, I've just spent a lot of time finding myself no solutions.

    Thanks for the help!

    Mike

  9. #9
    Registered User
    Join Date
    10-30-2012
    Location
    Milwaukee
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Excel VBA in a userform that create a hyperlink into a specific cell location

    This copy of the document may be a little better to work with.

    I got rid of the reference and I noted on the user form of the issue.

    -Mike
    Attached Files Attached Files

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel VBA in a userform that create a hyperlink into a specific cell location

    So the file name should go in the textbox labelled 'Mount #' on the form 'viewrecord'?

  11. #11
    Registered User
    Join Date
    10-30-2012
    Location
    Milwaukee
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Excel VBA in a userform that create a hyperlink into a specific cell location

    I was looking to get the file name placed in the textbox named 'txtpic1'. If you view the userform form 'viewrecord' as an object, there will be a text box next to picture links. The cells are initally locked until the user clicks the edit button. Once the edit button is selected then 3 cells are allowed to be edited. This is where i hope to use that ADD button 'CommandButton2_Click' to initalize the GetFilePath. Once the file path directory is found I hope to copy it into the 'txtpic1' box without finishing the editing. Is it also possible to have that file path then changed into a hyperlink before being copied over?

    Below is the part of the code that has txtpic1 during the editing version.
    Please Login or Register  to view this content.

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel VBA in a userform that create a hyperlink into a specific cell location

    So you are talking about the controls in the hidden part of the userform?

    This will put the filename and path for the selected file in the textbox txtpic1.
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    10-30-2012
    Location
    Milwaukee
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Excel VBA in a userform that create a hyperlink into a specific cell location

    You are such a life saver!!!
    I was so close, but once reading over your code I realized i was just defining the wrong value.
    THANKS SO MUCH!!!!

    One other thing tho, I'm trying to play around the hyperlink function. I would like to make that textbox be a hyperlink. Can I do that before it places it into the textbox or is it better to just save the value as a hyperlink once I click the submit button?

    Thanks again..
    Mike

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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