Consulting

Results 1 to 2 of 2

Thread: Attach Hyperlinked Documents to email

  1. #1

    Question Attach Hyperlinked Documents to email

    Hi

    I have a spreadsheet with a list of hyperlinks to documents.
    I have a checkbox next to each hyperlink to select the relevant ones.
    I would like to attach the documents selected to an email.
    Probably I would click on a command button to do this.
    I can then complete the email manually and send it.

    Is this possible?
    Could you give me some assistance with the VBA please.

    Many thanks
    Scriptham

  2. #2
    VBAX Regular GreenDR's Avatar
    Joined
    Oct 2012
    Location
    India
    Posts
    25
    Location
    try this:
    [VBA]
    Sub Example()
    Dim oOutlook As Outlook.Application
    Dim oEmailItem As MailItem

    On Error Resume Next
    Set oOutlook = GetObject(, "Outlook.Application")
    If oOutlook Is Nothing Then Set oOutlook = CreateObject("Outlook.Application")

    Set oEmailItem = oOutlook.CreateItem(olMailItem)

    With oEmailItem
    .Attachments.Add Range("A1").Hyperlinks(1).Address
    .Display
    End With

    Set oEmailItem = Nothing
    Set oOutlook = Nothing

    End Sub
    [/VBA]

    Replace the range address per your requirement
    GreenDR

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •