+ Reply to Thread
Results 1 to 10 of 10

savecopyas workbook - hyperlinks are changing to the new workbook name - erroneously

  1. #1
    Registered User
    Join Date
    12-03-2012
    Location
    Omaha, Nebraska
    MS-Off Ver
    2010
    Posts
    39

    savecopyas workbook - hyperlinks are changing to the new workbook name - erroneously

    Okay,
    wb1 is a template file (or a home workbook with multiple functions).
    wb2 is a savecopyas wb that is made via macro within wb1. It is a slimmed down version made from a template within wb1
    wb3 is a data file only.

    Hyperlinks within wb1 are set to wb3 at it's address (fixed).
    When wb2 is created via macro, the hyperlinks change address related to where wb2 is saved. I want them to remain fixed with where wb3 is.

    the correct link is as follows (as taken from wb1):
    =IF(ISNA(HYPERLINK(VLOOKUP(S44,'K:\swi\[SWIDATA.xlsm]Links'!$A$2:$B$9990,2,FALSE),Q44)),"",HYPERLINK(VLOOKUP(S44,'K:\swi\[SWIDATA.xlsm]Links'!$A$2:$B$9990,2,FALSE),Q44))

    The incorrect link as created when the new workbook is made is as follows:
    =IF(ISNA(HYPERLINK(VLOOKUP(S44,'K:\swi\Claim File Master\Claim Files\464004\[SWIDATA.xlsm]Links'!$A$2:$B$9990,2,FALSE),Q44)),"",HYPERLINK(VLOOKUP(S44,'K:\StillwaterInsurance\Claim File Master\Claim Files\464004\[SWIDATA.xlsm]Links'!$A$2:$B$9990,2,FALSE),Q44))

    Claim File Master\Claim Files\464004 is clearly added because that is where the new wb2 is located. How do I stop this?

    NOTE: i am open to suggestions (either vba when i create the copy or Excel in changing the template), thus the reason this has been posted in the VBA forum. I was unable to find a solution to this issue through days of research.

    Thanks,

    Darren

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: savecopyas workbook - hyperlinks are changing to the new workbook name - erroneously

    What about updating the formula via code while creating the new workbook?


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    12-03-2012
    Location
    Omaha, Nebraska
    MS-Off Ver
    2010
    Posts
    39

    Re: savecopyas workbook - hyperlinks are changing to the new workbook name - erroneously

    Quote Originally Posted by :) Sixthsense :) View Post
    What about updating the formula via code while creating the tomb gin.workbook?
    Absolutely not opposed to that. However, never been there with code. Wouldn't even know where to begin. Currently, excel handles my hyperlinks. I have already accepted the fact that I need to run code (it will reside in my savecopyas code) to handle activating each hyperlink.....so its just a small addition to the code. Can you point me in the right direction based on what is in the cells currently as indicated above?

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: savecopyas workbook - hyperlinks are changing to the new workbook name - erroneously

    Just change the A1:A5 to your desired range in the below code

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-03-2012
    Location
    Omaha, Nebraska
    MS-Off Ver
    2010
    Posts
    39

    Re: savecopyas workbook - hyperlinks are changing to the new workbook name - erroneously

    Quote Originally Posted by :) Sixthsense :) View Post
    Just change the A1:A5 to your desired range in the below code

    Please Login or Register  to view this content.
    Yeah.....figures It would be that easy. I will apply it tomorrow. Never used vba to enter formula before. Smooth. Thanks sense. I consider his thread solved and a * for you. Appreciate it.

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: savecopyas workbook - hyperlinks are changing to the new workbook name - erroneously

    Glad it helps you and thanks for the feedback

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  7. #7
    Registered User
    Join Date
    12-03-2012
    Location
    Omaha, Nebraska
    MS-Off Ver
    2010
    Posts
    39

    Re: savecopyas workbook - hyperlinks are changing to the new workbook name - erroneously

    Quote Originally Posted by :) Sixthsense :) View Post
    Glad it helps you and thanks for the feedback

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Hey Sense,
    Please Login or Register  to view this content.
    getting an error on this line. I trimmed it down to one line as indicated in my code but getting runtime error 1004. any thoughts?

  8. #8
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: savecopyas workbook - hyperlinks are changing to the new workbook name - erroneously

    Replace this "" with """"

    Refer my Post #4 code for details

  9. #9
    Registered User
    Join Date
    12-03-2012
    Location
    Omaha, Nebraska
    MS-Off Ver
    2010
    Posts
    39

    Re: savecopyas workbook - hyperlinks are changing to the new workbook name - erroneously

    I see. Oops. Thx again. Works like a charm. Double quotes inside quotes. In got sloppy.

    D

  10. #10
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: savecopyas workbook - hyperlinks are changing to the new workbook name - erroneously

    Because in VBA we are quoting the formula within double quotes "YourFormula".

    So if your formula has any double quotes twice then you have to convert it as Four Double Quotes

+ 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. [SOLVED] VBA / Macro help needed to SaveCopyAs workbook with specific sheets
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-27-2013, 02:33 PM
  2. [SOLVED] Export/Save a worksheet in a workbook without changing the name of the workbook?
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2013, 06:04 PM
  3. [SOLVED] SaveCopyAs Workbook rather than saveAs
    By hommer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2013, 04:25 AM
  4. [SOLVED] Macro to copy data to a workbook from another workbook with a changing file name
    By gruittbm in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-11-2012, 05:28 PM
  5. Changing Workbook names in VBA based on Open Workbook
    By peakymatt in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-16-2009, 12:06 AM

Tags for this Thread

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