Jump to content

How to Open EN Mac Classic Link in Microsoft Word Using VBA


Recommended Posts

  • Level 5*

How to Open EN Mac Classic Link in Microsoft Word Using VBA

In response to another user's request, I have built several Microsoft Word 2011 Mac VBA macros that will allow you to save the Classic Note link to Word, and then, from Word, open the link in a new Note window.

Please see the GitHub Gist:
Open Evernote Classic (local) Link in MIcrosoft Word 2011 Mac Using Word VBA 

Note that any attempt to use the Word built-in hyperlink function (from the UI or VBA) will result in Word changing any URL protocol (like evernote:///) to a file protocol (file:///).  So, we can't use the Word hyperlink feature to display the note.

If you find any bugs or issues, or have suggestions for improvements, please post in the GitHub Gist Comments section for this code.

Quote

    '================================================================
    ' OpenEvernoteNote Sub Procedure
    '
    '   VER:  1.0       DATE:   2016-01-23
    '
    '   PURPOSE:  Open Evernote Note in a new window using Local EN Mac app
    '
    '   HOW TO USE:
    '
    '       1.  Create a hyperlink in Word using the local Evernote URL (evernote:///)
    '               • In EN Mac, right-click on Note in list, hold down OPTION key, and
    '                   select "Copy Classic Note Link"
    '               • Type Note title in Word, select,
    '                       press CMD+K to create hyperlink
    '                       Paste link from clipboard
    '               • Word will change the URL, but ignore that
    '           OR
    '           Use this AppleScript to create RTF link and paste into Word:
    '               • Copy EN Note Link (Classic) AS.scpt
    '                   https://gist.github.com/JMichaelTX/0b14e9755ed77f347816
    '
    '       2.  Select this hyperlink, or just place the cursor anywhere within the link text
    '       3.  Run this macro
    '
    '   AUTHOR:
    '       JMichaelTX
    '
    '   REQUIRES:
    '       • Sub OpenURL()
    '       • Private Declare Function system Lib "libc.dylib" (ByVal command As String) As Long
    '
    '   REF:
    '       1.  How to Use the system() function from the standard C library in a VBA Macro
    '           http://stackoverflow.com/a/12320294/915019
    '           BY:  Robert Knight
    '
    '   COMMENTS:
    '       • Any attempt to use the Word built-in hyperlink function (from the UI or VBA) will result in Word
    '           changing any URL protocol (like evernote:///) to a file protocol (file:///).
    '       • Thus we can NOT use any of the Word hyperlink features, except as a tool
    '           to show friendly text and hide long URLs
    '       • The ONLY choice I have found is to call a Mac system function to "open" the custom URL.
    '
    '=================================================================
 

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...