Results 1 to 12 of 12

Outlook emails pulling attachments from Sharepoint

Threaded View

  1. #1
    Registered User
    Join Date
    06-23-2014
    Location
    MidWest, USA
    MS-Off Ver
    2016
    Posts
    89

    Outlook emails pulling attachments from Sharepoint

    Hello all,
    I have a script I built a couple years ago which creates emails in MS Outlook with predefined subject lines, addressees, and attachments. The end user can either run it to display or send. For 2 years it worked fine as I was referencing a simple shared folder for the required attachments. However, when my organization rolled out Sharepoint and upgraded the Office version we were on, the attachments started displaying as failed. I did of course update the file path to reference the Sharepoint Library the attachments were contained in. I do have permissions to that library and when I manually try to navigate to those locations, I have no problem doing so. The email still generates, but the file attachments display as "Download Failed" When I double click on them, it gives me a Retry option and when I select that the download actually succeeds.

    My code is below for your reference, and I'm attaching a screenprint of the email output.

    Sub Financial()
    
        Dim objOutlook As Object
        Dim objMail As Object
        Dim rngTo As Range
        Dim rngSubject As Range
        Dim rngBody As Range
        Dim rngAttach1 As Range
        Dim rngAttach2 As Range
        Dim emailTo As String
        Dim emailBody As String
        Dim emailSubject As String
    
        Set objOutlook = CreateObject("Outlook.Application")
        Set objMail = objOutlook.CreateItem(0)
        
        
        emailTo = ""
        For Each cell In Range("FinancialRateSheet")
            If cell.Value <> "" Then emailTo = emailTo & cell.Value & "; "
        Next
        
        
        emailbody1 = Range("Financial_Message").Value
    
    
    
    
        emailBody3 = "<br><br>" & "<img src='C:\TempPath\logo.jpg'>"
    
        
        
        emailSubject = ""
        For Each cell In Range("Financial_Subject")
            If cell.Value <> "" Then emailSubject = emailSubject & cell.Value
        Next
        
        
    
        With ActiveSheet
            Set rngAttach1 = .Range("C6")
            Set rngAttach2 = .Range("L1")
        End With
    
        With objMail
            .To = ""
            .BCC = emailTo
            .Subject = emailSubject
            .HTMLbody = emailbody1 & emailbody2 & emailBody3 & "<br>" & .HTMLbody
            .Attachments.Add rngAttach1.Value
            .Attachments.Add rngAttach2.Value
            .Display
            
        End With
    
        Set objOutlook = Nothing
        Set objMail = Nothing
        Set rngTo = Nothing
        Set rngSubject = Nothing
        Set rngBody = Nothing
        Set rngAttach1 = Nothing
        Set rngAttach2 = Nothing
        
        
        
    
    End Sub
    Attached Images Attached Images

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Excel Macro to Send Multiple Emails w/ Attachments using MS Outlook 2007
    By arnel_10 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2017, 08:09 PM
  2. VBA coding in Outlook 2010 to save attachments from emails
    By Ravipoojari in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2015, 05:28 AM
  3. Accessing Outlook Attachments from Saved Emails
    By crunchKH in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2013, 12:38 AM
  4. Macro to get the data exported to an excel from Outlook emails and or attachments?
    By lifeisaspreadsheet in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2012, 04:31 PM
  5. outlook, attachments,sharepoint,excel usage
    By LiLi1 in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 12-09-2011, 04:00 PM
  6. Excel to open workbook attachments in emails in Outlook subfolders
    By Julesdude in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-13-2010, 09:23 AM

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