Microsoft Office Tutorials and References
In Depth Information
Remote Control with Outlook E-mail Message
View the Appendix to learn how to store this procedure
in the ThisOutlookSession module.
Dim myFolderEventsClass As clsRemoteControl¶
Public Sub Application_Startup()¶
'Create class object for handling receiving email items¶
Set myFolderEventsClass = New clsRemoteControl¶
End Sub¶
The following code goes in a new class module. In the Properties window,
change the name to clssRemoteControl by typing in the box to the right of
Name. Copy and paste the following code into the ‘clsRemoteControl’ object
class module in Outlook VBA.
View the Appendix to learn how to store this procedure
in a Class module.
Option explicit¶
'* * * * *¶
Public WithEvents myOlItems As Outlook.Items¶
Private Sub Class_Initialize()¶
Set myOlItems = Outlook.Session _¶
.GetDefaultFolder(olFolderInbox).Items¶
End Sub¶
'* * * * *¶
Private Sub myOlItems_ItemAdd(ByVal Item As Object)¶
'Verify if item is a MailItem¶
If TypeName(Item) = "MailItem" Then¶
'Run main module to send email¶
Call AutoSendEmail(Item)¶
End If¶
End Sub¶
'* * * * *¶
Private Sub AutoSendEmail(objMail As MailItem)¶
'Variable declaration¶
Dim strSubject As String¶
Dim strFileName As String¶
Dim strReplyMsg As String¶
Dim fileNameStart As Long¶
Dim fileNameEnd As Long¶
'Redemption SafeMail object declaration¶
Dim objSafeMail As Object¶
'Set variables here¶
strSubject = "Send me file."¶
strReplyMsg = "Your file is attached."¶
'Redemption Additional starts here¶
'Create Redemption SafeMail object¶
Out
Search JabSto ::




Custom Search