1. To remove the text in the message body, delete the lines
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
Set oRng = wdDoc.Range(0, 0)
oRng.Text = "Please find attached file: " & olAttach.FileName ' The message text
and
Set olInsp = Nothing
Set wdDoc = Nothing
Set oRng = Nothing
2. You didn't test it? The bold part of
CreateMessage strPath & strFile, Mid(strFile, 2, 2)
should collect the two filename characters for the message subject
3. The message is sent from the default account. You can send it instead from a named account e.g.
Sub CreateMessage(strAtt As String, strChar As String)
Dim oAccount As Account
Dim olMail As MailItem
Dim olAttach As Attachment
Const strAcc = "myaccount@somewhere.com" 'the name of the account to use
For Each oAccount In Application.Session.Accounts
If oAccount.DisplayName = strAcc Then
Set olMail = Outlook.CreateItem(olMailItem)
With olMail
.SendUsingAccount = oAccount
.To = "someone@somewhere.com"
.Subject = strChar
.Body = "" ' clear the body
Set olAttach = .Attachments.Add(strAtt)
.Display
'.sEnd '- Restore after testing
End With
Exit For
End If
Next
lbl_Exit:
Set olMail = Nothing
Set olAttach = Nothing
Set oAccount = Nothing
Exit Sub
End Sub