+ Reply to Thread
Results 1 to 4 of 4

Insert Hyperlink to WorkBook in which VBA Code resides

  1. #1
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Insert Hyperlink to WorkBook in which VBA Code resides

    Hey crew,

    I have this code that saves the newly created worksheet (from Code that imports text to excel) as a new workbook:
    Please Login or Register  to view this content.
    After this piece of code run (from a form), it goes back to the workbook in which the code resides and do other stuff (clears the sheet that just got converted to a brand new workbook, clears connections and querytables, etc, etc.).

    After all the above is done, I would like to go to
    Please Login or Register  to view this content.
    And add a hyper link to the file just created and saved by the code above. And I want the text to be displayed "cboRptname.Value & " " & cboYear.Value & cboMonth.Value & cboDay.Value & ".xls"

    Can anybody help?

    EDIT: I tried the macro recorder, but I use xl07 and I want users on xl03 to use the file as well, and I'm always concerned with the way xl07 records code that it may not work on earlier versions.
    Last edited by ron2k_1; 07-01-2011 at 01:11 PM.
    Ron
    Knowledge is knowing that a tomato and pepper are fruits. Wisdom is knowing whether to put these in a fruit salad

    Kindly

    [1] Use code tags. Place "[code]" before the first line of code and "[/code"]" after the last line of code. Exclude quotation marks
    [2] Mark your post [SOLVED] if it has been answered satisfactorily by editing your original post in advanced mode.
    [3] Thank (using the little scale) those that provided useful help; its nice and its very well appreciated

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Insert Hyperlink to WorkBook in which VBA Code resides

    Stab in the dark here, might get your far enough along to work it out exactly for yourself:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Re: Insert Hyperlink to WorkBook in which VBA Code resides

    Good stabbing JB, I was trying a to modify my recorded macro, and the only thing different that I had was that I selected A7 first and then on the hyperlink syntax, after Anchor I stated .Selection. Your method is faster.

    I put it along with my other procedures and it does the trick.

    Thanks,

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Insert Hyperlink to WorkBook in which VBA Code resides

    Ron,

    The speed cost of using a SELECT method is always huge. I recommend you never do that, always bring your code here and let us help you devise a non-select approach, the speed result is worth the extra work.

    Most efficient method will always be to address your commands directly to the sheet cells using fully resolved addresses, that way it never matters what is "active" in terms of workbooks, worksheets, the command still executes directly to where you indicated.

    Notice how I used the WITH method to add that full parent at the start and then attach it to all the commands that occur in the WITH section?

+ 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