A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Saving mail (.msg) after clicking context menu button



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 12th 06, 02:30 PM posted to microsoft.public.outlook.program_vba
davemode
external usenet poster
 
Posts: 2
Default Saving mail (.msg) after clicking context menu button

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.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving mail (.msg) after clicking context menu button davemode Outlook and VBA 1 June 12th 06 05:59 PM
Can't access contacts list when clicking on To button in new email John M, Outlook - Using Contacts 3 May 26th 06 01:42 PM
adding a context menu in Outlook donald Add-ins for Outlook 6 May 3rd 06 01:49 PM
How do I add a new option in the context menu(Outlook)? Outllok - context menus aad ins Outlook - Using Forms 5 March 16th 06 02:47 PM
Context Menu not present Mono Outlook Express 5 February 7th 06 06:22 PM


All times are GMT +1. The time now is 03:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.