Attach documents from sharepoint to email along with To,cc, & email body from excel file

darshank123

New Member
Joined
Dec 13, 2019
Messages
4
Office Version
  1. 2013
Platform
  1. Windows
Hi,

Am looking for some code where it will fetch and attach files directly form sharepoint to outloook email(2013) with other fields like To,cc and email body as well and it has to fecthc these details from excel file.

Am using sharepoint portal.Please help with this.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi

Here is the code which displays email but not attaching file Test.xlsx from sharepoint portal to email

can you please help me with this.

Sub sharepoint()
'
' sharepoint Macro
'

Dim OutApp
Dim OutMail As Outlook.MailItem
Dim ExtAttach, EVMmail As String
'Sheets("Macro Run Controls").Select
ExtAttach = "https://xxxxxx.sharepoint.com/sites/xxxxxx/Library/Faci templates/test.xlsx"
'EVMmail = C:\Location of saved email template
'Create the external manager email

Set OutApp = CreateObject("Outlook.Application")
On Error Resume Next
Set OutMail = OutApp.CreateItem(0)
With OutMail
' .SentOnBehalfOfName = ""
.To = ""
.CC = ""

StrFile = Dir(ExtAttach & "*.*")

'Do While Len(StrFile) > 0
.Attachments.Add ExtAttach & StrFile
StrFile = Dir
'Loop

.Display 'or use .Send
End With
On Error GoTo 0

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,303
Members
449,078
Latest member
nonnakkong

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top