I'm an absolute n00b at VBA and was wondering if someone who knows what they're doing could critique the following code that I cobbled together. All I can say is that it works-but I'm sure there's room for improvement


Option Compare Database
Option Explicit

Private Sub cmdSendEmail_Click()
Dim strMbrID As String
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim rdSafeItem 'I'm not sure what to explicitly dim these as
Dim oItem 'or even if I should
Dim strSubj As String
Dim strTo As String
Dim strBodyText As String
Dim strVOContact As String
Dim strCsrFull As String
Dim strCsrFirst As String
Dim strFile1 As String 'Surely there's a more elegant way to add
Dim strFile2 As String ' two atch's to each email........

'Open Outlook and connect to namespace
Set olApp = CreateObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")

'Make a new item using Redemption
Set rdSafeItem = CreateObject("Redemption.SafeMailItem")
Set oItem = olApp.CreateItem(0)
rdSafeItem.Item = oItem

'Make strings for the msg
strMbrID = VOMemberID
strVOContact = CMFirstName & " " & CMLastName
strSubj = "URGENT: Permanent Housing opportunity"
strTo = CMFirstName & "." & CMLastName & "@someaddress.com"
strCsrFull = CsrFirstName & " " & CsrLastName
strCsrFirst = CsrFirstName
strFile1 = "H:\Wait List\Contacts\Forms\ChangeofStatus.doc"
strFile2 = "H:\Wait List\Contacts\Forms\HomelessVerification.doc"

strBodyText = "My pithy text is here"

'build the msg
With rdSafeItem
.Subject = strSubj
.Importance = olImportanceHigh
.Attachments.Add strFile1
.Attachments.Add strFile2
.FlagStatus = olFlagMarked
.Recipients.Add strTo
.Body = strBodyText
.Display ' Change to .Send to send immediately
End With

'cleaning up my mess-should I have an entry for each item Dim'd?
Set olApp = Nothing
Set olNS = Nothing
Set rdSafeItem = Nothing
Set oItem = Nothing

Exit Sub

MsgBox Err.Description
Resume Exit_cmdSendEmail_Click

End Sub