Pinaceous
Well-known Member
- Joined
- Jun 11, 2014
- Messages
- 1,124
- Office Version
- 365
- Platform
- Windows
Hi All,
I'm working on a sub, which attaches This Workbook file as the attachment in the proposed outlook email pop-up:
However, in using SharePoint the filename is being altered/changed.
For example, when I run the code upon the workbook that I'm using it's titled: "FY23 TOTALS STUFF .xlsm" but when I run the code it attaches it as : "FY23%20TOTALS%20STUFF%20.xlsm".
Can someone help me with this code to send the "FY23 TOTALS STUFF .xlsm" filename in lieu of the "FY23%20TOTALS%20STUFF%20.xlsm"?
Please let me know.
Thank you!
Respectfully,
pinaceous
I'm working on a sub, which attaches This Workbook file as the attachment in the proposed outlook email pop-up:
VBA Code:
Sub SendingEmail()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim SigString As String
Dim Signature As String
'Dim strAppend As String
'Dim strEmailWb As String
'strEmailWb = ThisWorkbook.FullName
'strEmailWb = Replace(strEmailWb, ".xlsm", strAppend & ".xlsm")
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "Hi Team,</H3>" & _
"Please see attached file for the day.</H3>" & _
"<br><br>Thank you!"
SigString = Environ("appdata") & _
"\Microsoft\Signatures\Untitled.htm"
If Dir(SigString) <> "" Then
Signature = GetBoiler(SigString)
Else
Signature = ""
End If
On Error Resume Next
With OutMail
.to = "XYZ@something.com"
.CC = " "
.Subject = Worksheets(1).Range("A53").Value
.HTMLBody = strbody & "<br>" & Signature
'.Attachments.Add strEmailWb
.Attachments.Add ThisWorkbook.FullName
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Function GetBoiler(ByVal sFile As String) As String
Dim fso As Object
Dim ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
GetBoiler = ts.readall
ts.Close
End Function
However, in using SharePoint the filename is being altered/changed.
For example, when I run the code upon the workbook that I'm using it's titled: "FY23 TOTALS STUFF .xlsm" but when I run the code it attaches it as : "FY23%20TOTALS%20STUFF%20.xlsm".
Can someone help me with this code to send the "FY23 TOTALS STUFF .xlsm" filename in lieu of the "FY23%20TOTALS%20STUFF%20.xlsm"?
Please let me know.
Thank you!
Respectfully,
pinaceous