+ Reply to Thread
Results 1 to 9 of 9

How do I create a Hyperlink in Excel from Word Macro

  1. #1
    Registered User
    Join Date
    03-17-2010
    Location
    england
    MS-Off Ver
    Excel 2003
    Posts
    7

    How do I create a Hyperlink in Excel from Word Macro

    Hi All,

    I'm creating a macro in Word.

    When I close down the Word document I am trying to get the Macro to open an excel spreadsheet and create a hyperlink in a cell so that when I next load the excel spreadsheet, I can just click on the hyperlink to take me to the word document.

    I know I'm doing something wrong with the creation of the hyperlink. I feel it has something to do with the anchor but I am just not experienced enough to figure out the problem.

    The Code I have is:

    Please Login or Register  to view this content.
    Last edited by jrp_167; 03-23-2010 at 04:58 AM.

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: How do I create a Hyperlink in Excel from Word Macro

    Try with:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  3. #3
    Registered User
    Join Date
    03-17-2010
    Location
    england
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: How do I create a Hyperlink in Excel from Word Macro

    Quote Originally Posted by antoka05 View Post
    Try with:
    Please Login or Register  to view this content.
    Regards,
    Antonio
    That worked perfectly!! Thanks very much for your help!!

  4. #4
    Registered User
    Join Date
    03-17-2010
    Location
    england
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: How do I create a Hyperlink in Excel from Word Macro

    Hi there!

    I ended up getting the code working like you said using :

    Please Login or Register  to view this content.
    However, I then tried to expand the code so that rather than always placing the hyperlink in A6, It looked for the next blank cell in Column A and added the hyperlink there.

    Remembering that this Macro is embedded in the Word document, I came up with the following (But it doesn't work):

    Please Login or Register  to view this content.
    But it doesn't like the line :

    Please Login or Register  to view this content.
    Any ideas?

  5. #5
    Registered User
    Join Date
    03-03-2010
    Location
    Oxfordshire
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: How do I create a Hyperlink in Excel from Word Macro

    The Code Really looks good however i Cant get it going


    Please Login or Register  to view this content.
    I have Simply Cut and Paste and using a test excell file and a test word file and it has slight Issues with the

    := in line one and the , at the end of line one.

    (Sorry I really am at the bottom of this learning curb)

    Daniel1234

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How do I create a Hyperlink in Excel from Word Macro

    Daniel, please take a few minutes to read the forum rules, and then start your own thread.
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Registered User
    Join Date
    03-17-2010
    Location
    england
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: How do I create a Hyperlink in Excel from Word Macro

    Quote Originally Posted by Daniel1234 View Post
    The Code Really looks good however i Cant get it going


    Please Login or Register  to view this content.
    I have Simply Cut and Paste and using a test excell file and a test word file and it has slight Issues with the

    := in line one and the , at the end of line one.

    (Sorry I really am at the bottom of this learning curb)

    Daniel1234
    needs a _ at the end of line one to signify it continues on the next line down

    i.e.

    Please Login or Register  to view this content.

    Just to keep the context of the thread correct. I still need help on what is wrong with:

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: How do I create a Hyperlink in Excel from Word Macro

    When you run macro from Word you can't use Excel constants as 'xlUp'.
    I think the best way is you go on Word, open VB Editor (alt + F11), choose Tools, Reference and select 'Microsoft Excel xx.x Object Library'.
    Regards,
    Antonio

  9. #9
    Registered User
    Join Date
    03-17-2010
    Location
    england
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: How do I create a Hyperlink in Excel from Word Macro

    Quote Originally Posted by antoka05 View Post
    When you run macro from Word you can't use Excel constants as 'xlUp'.
    I think the best way is you go on Word, open VB Editor (alt + F11), choose Tools, Reference and select 'Microsoft Excel xx.x Object Library'.
    Regards,
    Antonio
    Ah!! I did that in excel to run the Microsoft Word Object Library but I didnt do it for the 'Microsoft Excel xx.x Object Library' in Word! Thanks for the help!!

    My final Question regarding this is that I want a Msgbox to appear over the excel sheet once the info is written to the cells to say that the Register has been updated

    So as you see, I wrote the last line in the code to create a msgbox:

    Please Login or Register  to view this content.
    However, The Message box, I guess cause it is in the Word Macro Is not shown immediately as it is hovering over the word document (But the current view is of the populated cells in the excel sheet). To click ok, the user then has to select the word document to see the message box.

    I want the message box to hover over the excel view. Is this possible?

+ 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