+ Reply to Thread
Results 1 to 4 of 4

Insert a formula with hyperlink

  1. #1
    Registered User
    Join Date
    06-25-2015
    Location
    Toronto
    MS-Off Ver
    2013
    Posts
    43

    Insert a formula with hyperlink

    Hi there,

    I need to insert User Defined Formula into Word file. Meanwhile a hyperlink is with the result of User Defined Formula.

    Word will show UDF result with the hyperlink.
    When clicking on the result, the hyperlink will lead to another file;

    I know the way to insert the formula and the hyperlink, but how to bind them together ?
    Thanks,

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Insert a formula with hyperlink

    You can create a formula using field coding, but the output of such a field cannot itself be a hyperlink. Conversely, you could insert a formula field into a hyperlink, so as to change the hyperlink address, for example, but that won't change the hyperlink display text.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    06-25-2015
    Location
    Toronto
    MS-Off Ver
    2013
    Posts
    43

    Re: Insert a formula with hyperlink

    Hi Mcropod,

    Thanks for your help.
    I have this issue resolved by following steps:
    1. get the selection, like Word::SelectionPtr;
    2. add the formula field to the selection;
    3. set the range of the selection from the start to the end of field parent, like pSelection->SetRange(start, end);
    4. add the hyperlink by using the range as the anchor like pHyperlinks->Add(pRange, COleVariant(link));

    Regards,

  4. #4
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Insert a formula with hyperlink

    Evidently you're using code of some sort. Your initial post made no mention of that; neither was it posted in https://www.excelforum.com/word-programming-vba-macros/, where it should have been, so you didn't give yourself much chance of obtaining a relevant answer...

+ 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. insert hyperlink vba
    By mabughazza in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-14-2013, 02:47 AM
  2. Replies: 1
    Last Post: 02-23-2013, 05:18 AM
  3. Insert hyperlink via VBA
    By ss002d6252 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2010, 02:02 PM
  4. [SOLVED] Insert Hyperlink
    By lsmft in forum Excel General
    Replies: 4
    Last Post: 12-30-2007, 07:29 AM
  5. How do I insert the value of a cell into a Hyperlink
    By CW2 James Reed in forum Excel General
    Replies: 1
    Last Post: 03-04-2006, 12:30 PM
  6. [SOLVED] Sub to extract path from hyperlink formula and insert picture into comments
    By Max in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-03-2006, 11:10 AM
  7. [SOLVED] Insert Hyperlink
    By Nigel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-09-2006, 09:35 PM
  8. [SOLVED] insert hyperlink
    By Gary''s Student in forum Excel General
    Replies: 0
    Last Post: 11-19-2005, 10:20 AM

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