Name

hyperlink.EmailSubject [= setting]

Synopsis

Gets or sets the subject line of a mailto: link. This property overrides the subject setting included in the URL. For example, the following code creates an email link with a subject, but then changes the subject line:

Sub CreateMailLink(  )
    Dim ws As Worksheet, hyp As Hyperlink
    Set ws = ActiveSheet
    ' Create an email link.
    Set hyp = ws.Hyperlinks.Add([a3], _
       "mailto:someone@microsoft.com&subject=Help on Excel", _
      , "Click to send mail.", "Contact Microsoft")
    ' Change the subject...
    hyp.EmailSubject = "Different subject"
End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.