• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 489
  • Last Modified:

Adding an Excel Hyperlink in Outlook with an Excel Macro

Hi Guys, I am sending a Excel piece of work to my manager which he must approve via e-mail.
He wants a hyperlink to the Excel path in his e-mail so he can see it straight away. I have this code which sends him the e-mail from an Excel button with Voting Buttons but only text appears not a Hyperlink. Any ideas how its done?  
Justin
  With OutMail
            .To = "cscanln@mfglobal.com;"
               
            .VotingOptions = "Approve;Reject"    'you can include what you want in fact

            .CC = ""
            .BCC = ""
            .Subject = "FITR Dailies - "
            .Application.ActiveInspector.CurrentItem.HTMLBody = "G:\Restricted\UKMFG-TS-AM-EUC03\TRES\FITR - P11 Feb'11\FITR Oracle Dailies Feb'11.xlsm"

                  .Display
        End With
'        On Error GoTo 0
0
JCutcliffe
Asked:
JCutcliffe
  • 2
1 Solution
 
David LeeCommented:
Hi, Justin.

You have to format the link as a hyperlink using HTML tags.  Change this line

.Application.ActiveInspector.CurrentItem.HTMLBody = "G:\Restricted\UKMFG-TS-AM-EUC03\TRES\FITR - P11 Feb'11\FITR Oracle Dailies Feb'11.xlsm"

to

.Application.ActiveInspector.CurrentItem.HTMLBody = "<a href=""file://G:\Restricted\UKMFG-TS-AM-EUC03\TRES\FITR - P11 Feb'11\FITR Oracle Dailies Feb'11.xlsm"">Open the spreadsheet</a>"
0
 
JCutcliffeAuthor Commented:
Hi I am getting "Run time error '438' Object does not support this property or method" using your code (see below). Any ideas why?

    .To = "canlan@mfglobal.com;"
               
            .VotingOptions = "Approve;Reject"  
                   .Subject = "FITR Dailies - "
            .Body = "G:\Restricted\UKMFG-TS-AM-EUC03\TRES\FITR - P11 Feb'11\FITR Oracle Dailies Feb'11"
          Application.ActiveInspector.CurrentItem.HTMLBody = "<a href=""file://G:\Restricted\UKMFG-TS-AM-EUC03\TRES\FITR - P11 Feb'11\FITR Oracle Dailies Feb'11.xlsm"">Open the spreadsheet</a>"
                  .Display
0
 
David LeeCommented:
Which line is the error on?
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now