D
davemode
Hello everybody!!
I created a new button in the context menu
(http://www.outlookcode.com/codedetail.aspx?id=314) and so I wanted to
save the selected mail to the harddisk.
I found some code snipes like that:
' ### first find the selected item ###
Dim objApp As Application
Dim objItem As Object
Dim objSelection As Selection
Dim intMaxItems As Integer
intMaxItems = 5
Set objApp = CreateObject("Outlook.Application")
Set objSelection = objApp.ActiveExplorer.Selection
Select Case objSelection.Count
Case 0
MsgBox "No items were selected"
Case Is > intMaxItems
MsgBox "Too many items were selected"
Case Else
'objSelection.Item
End Select
To save a mail I should use the mailItem-Object, but this only shows
how to save an new mail:
Dim myItem As Outlook.Inspector
Dim objItem As Object
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector
If Not TypeName(myItem) = "Nothing" Then
Set objItem = myItem.CurrentItem
strname = objItem.Subject
'Prompt the user for confirmation
objItem.SaveAs "C:\" & strname & ".txt", olTXT
End If
Else
MsgBox "There is no current active inspector."
End If
Now I want to merge these two code snipets, but I have no idea how to
manage it!
Has anybody an idea how I can save the selected mail by right-Clicking
in the context-menu?
Thank you for your help!!!
Walter.
I created a new button in the context menu
(http://www.outlookcode.com/codedetail.aspx?id=314) and so I wanted to
save the selected mail to the harddisk.
I found some code snipes like that:
' ### first find the selected item ###
Dim objApp As Application
Dim objItem As Object
Dim objSelection As Selection
Dim intMaxItems As Integer
intMaxItems = 5
Set objApp = CreateObject("Outlook.Application")
Set objSelection = objApp.ActiveExplorer.Selection
Select Case objSelection.Count
Case 0
MsgBox "No items were selected"
Case Is > intMaxItems
MsgBox "Too many items were selected"
Case Else
'objSelection.Item
End Select
To save a mail I should use the mailItem-Object, but this only shows
how to save an new mail:
Dim myItem As Outlook.Inspector
Dim objItem As Object
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector
If Not TypeName(myItem) = "Nothing" Then
Set objItem = myItem.CurrentItem
strname = objItem.Subject
'Prompt the user for confirmation
objItem.SaveAs "C:\" & strname & ".txt", olTXT
End If
Else
MsgBox "There is no current active inspector."
End If
Now I want to merge these two code snipets, but I have no idea how to
manage it!
Has anybody an idea how I can save the selected mail by right-Clicking
in the context-menu?
Thank you for your help!!!
Walter.