Created
March 24, 2014 08:33
-
-
Save dck-jp/9736389 to your computer and use it in GitHub Desktop.
Outlook: Insert Signature to Mail Body
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Public Sub CreateMail(mailAddress as String) | |
| Dim subject As String: subject = "案内状" | |
| Dim sig As String: sig = ReadAllText("C:\Users\yamakawa\AppData\Roaming\Microsoft\Signatures\通常.txt") | |
| Dim StrBody As String: StrBody = "ほげほげ株式会社" & vbCrLf & _ | |
| "ふがふが様" & vbCrLf & _ | |
| vbCrLf & _ | |
| "中略。以上。" & vbCrLf & _ | |
| vbCrLf & _ | |
| sig | |
| Call CreateByOutlook2010(subject, StrBody, mailAddress) | |
| End Sub | |
| Public Function ReadAllText(fileName As String) | |
| Dim fso As Object, buf As String | |
| Set fso = CreateObject("Scripting.FileSystemObject") | |
| With fso.GetFile(fileName).OpenAsTextStream(1, -2) | |
| buf = .ReadAll | |
| .Close | |
| End With | |
| Set fso = Nothing | |
| ReadAllText = buf | |
| End Function | |
| Sub CreateByOutlook2010(subject As String, body As String, mailAddress As String) | |
| Dim OL: Set OL = CreateObject("Outlook.Application") | |
| Dim ML: Set ML = OL.CreateItem(olMailItem) | |
| ML.To = mailAddress | |
| ML.subject = subject | |
| ML.body = body | |
| ML.Display | |
| End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment