Option Explicit
Dim X As Long
Private Sub Command1_Click()
If X - 1 < 0 Then
Else
X = X - 1
MAPIMessages1.MsgIndex = X
Text1.Text = MAPIMessages1.RecipDisplayName
Text2.Text = MAPIMessages1.MsgSubject
Text3.Text = MAPIMessages1.MsgOrigDisplayName
Text4.Text = MAPIMessages1.MsgNoteText
End If
End Sub
Private Sub Command2_Click()
If X + 1 > MAPIMessages1.MsgCount Then
X = MAPIMessages1.MsgCount
Else
X = X + 1
MAPIMessages1.MsgIndex = X
Text1.Text = MAPIMessages1.RecipDisplayName
Text2.Text = MAPIMessages1.MsgSubject
Text3.Text = MAPIMessages1.MsgOrigDisplayName
Text4.Text = MAPIMessages1.MsgNoteText
End If
End Sub
Private Sub Command3_Click()
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Fetch
If MAPIMessages1.MsgCount > 0 Then
Text1.Text = MAPIMessages1.RecipDisplayName
Text2.Text = MAPIMessages1.MsgSubject
Text3.Text = MAPIMessages1.MsgOrigDisplayName
Text4.Text = MAPIMessages1.MsgNoteText
Command4.Enabled = True
Else
MsgBox "No messages to fetch"
MAPISession1.SignOff
Command4.Enabled = False
End If
End Sub
Private Sub Command4_Click()
MAPIMessages1.Compose
MAPIMessages1.RecipDisplayName = Text1.Text
MAPIMessages1.MsgSubject = Text2.Text
MAPIMessages1.MsgNoteText = Text4.Text
MAPIMessages1.ResolveName
MAPIMessages1.Send
End Sub
Private Sub Command5_Click()
MAPISession1.SignOff
Unload Me
End Sub