Hello,
I'm trying to setup a file that saves the data into directory in SharePoint but run into issues. Below is what I typically use to have the file saved to my computer just changed the path to the SharePoint site but it's giving me an error. Can you tell me what I'm doing wrong? Thanks so much in advance!
Sub Send_email()
Dim MailItem As Object
Dim MyPath As String
Dim MyFileName As String
Dim MyOutFile As String
Dim MyCopyRange As String
Dim MyLastDataRow As Integer
Dim MySheetName As String
EmailSendTo = ""
EmailBody = ""
Application.ScreenUpdating = False
MyPath = "//SharePointSite/sites/Directory1/SubD2/SubD3/Subd4/Subd5"
MyFileName = Range("N2")
MySheetName = "Manifest"
ActiveWorkbook.Sheets("Manifest").Select
If Not Right(MyPath, 1) = "/" Then MyPath = MyPath & "/"
MyOutFile = MyPath & MyFileName & ".xlsm"
ActiveWorkbook.SaveAs MyOutFile, FileFormat:=52
Application.DisplayAlerts = True
EmailSubject = "Email Subject " & MyFileName & ".xlsm"
Set MailObject = CreateObject("Outlook.Application")
Set MailItem = MailObject.CreateItem(0)
With MailItem
.Subject = EmailSubject
.Attachments.Add MyOutFile
.Display (True)
End With
TryAgain:
End Sub
I'm trying to setup a file that saves the data into directory in SharePoint but run into issues. Below is what I typically use to have the file saved to my computer just changed the path to the SharePoint site but it's giving me an error. Can you tell me what I'm doing wrong? Thanks so much in advance!
Sub Send_email()
Dim MailItem As Object
Dim MyPath As String
Dim MyFileName As String
Dim MyOutFile As String
Dim MyCopyRange As String
Dim MyLastDataRow As Integer
Dim MySheetName As String
EmailSendTo = ""
EmailBody = ""
Application.ScreenUpdating = False
MyPath = "//SharePointSite/sites/Directory1/SubD2/SubD3/Subd4/Subd5"
MyFileName = Range("N2")
MySheetName = "Manifest"
ActiveWorkbook.Sheets("Manifest").Select
If Not Right(MyPath, 1) = "/" Then MyPath = MyPath & "/"
MyOutFile = MyPath & MyFileName & ".xlsm"
ActiveWorkbook.SaveAs MyOutFile, FileFormat:=52
Application.DisplayAlerts = True
EmailSubject = "Email Subject " & MyFileName & ".xlsm"
Set MailObject = CreateObject("Outlook.Application")
Set MailItem = MailObject.CreateItem(0)
With MailItem
.Subject = EmailSubject
.Attachments.Add MyOutFile
.Display (True)
End With
TryAgain:
End Sub