Hello again! My macro is working as I need it to, except it is not showing the file name correctly as the attachment. It is adding %20 where the spaces should be. This is saved to our OneDrive, so I understand it is because it is a URL. I also have found that I may can save this as a temp file and that would help, but I have no idea how to do that. I have the "send" commented out until I can get the file name correct. Any help would be most appreciated!! Here is my code...
VBA Code:
Dim EmailApp As Outlook.Application
Dim EmailItem As Outlook.MailItem
Dim fileName As String
Set EmailApp = New Outlook.Application
Set EmailItem = EmailApp.CreateItem(olMailItem)
fileName = ActiveWorkbook.Name
'If Not InStr(fileName, ".") > 0 Then
' MsgBox "File name does not have the correct format."
'Exit Sub
'Else
' fileName = Left(fileName, InStr(fileName, ".") - 30)
'End If
Application.Wait (Now + TimeValue("00:00:05"))
With EmailItem
.To = "michelle@myemail.com"
.SentOnBehalfOfName = "holley@myemail.com"
.CC = ""
.BCC = ""
.Subject = "Dates"
.HTMLBody = "Here is this quarters file." & vbNewLine & vbNewLine & "" & vbNewLine & ""
.Attachments.Add ActiveWorkbook.FullNameURLEncoded
.Display
Application.Wait (Now + TimeValue("0:00:00"))
'Application.SendKeys "%s"
ActiveWorkbook.Close
End With