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

trying to copy an email



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 4th 06, 03:50 AM posted to microsoft.public.outlook.program_vba
rub
external usenet poster
 
Posts: 4
Default trying to copy an email

I am trying to select an email and then copy it. Then I want the Inbox
folder window to appear. I will select a folder and the copy of the
email will be put there. I can't get by the line "Set oFolderSelected
= oIns.Selection". Any ideas



Sub MoveEmail()
Dim oApp As Outlook.Application
Dim oExp As Outlook.Explorer
Dim oSelected As Outlook.Selection
Dim oFolderSelected As Outlook.Selection
Dim oItem As Outlook.MailItem
Dim oFldr As Outlook.Folders
Dim oNS As Outlook.NameSpace
'Dim oFldr As Outlook.MAPIFolder
Dim oBackup As Outlook.MAPIFolder

Dim intNumber As Integer
Dim intInspector As Integer

Set oApp = Outlook.Application
Set oExp = oApp.ActiveExplorer
Set oIns = oApp.ActiveInspector

Set oSelected = oExp.Selection


If oSelected.Count 1 Then GoTo exit_outofhere

Set oItem = oSelected.Item(oSelected.Count)
Set oNS = oApp.GetNamespace("MAPI")

oItem.Copy

Set oBackup = oNS.GetDefaultFolder(olFolderInbox)
oBackup.Display
Set oFolderSelected = oIns.Selection
If oFolderSelected.Count 1 Then GoTo exit_outofhere
oFolderSelected =
oNS.GetDefaultFolder(olFolderInbox).Folders.Item(o FolderSelected.Count)
oItem.Move oFolderSelected


exit_outofhe
Exit Sub
End Sub

Ads
  #2  
Old November 4th 06, 06:17 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default trying to copy an email

Selection is the property of the Explorer object, not Namespace:
Set oFolderSelected = oExp.Selection

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"rub" wrote in message
ups.com...
I am trying to select an email and then copy it. Then I want the Inbox
folder window to appear. I will select a folder and the copy of the
email will be put there. I can't get by the line "Set oFolderSelected
= oIns.Selection". Any ideas



Sub MoveEmail()
Dim oApp As Outlook.Application
Dim oExp As Outlook.Explorer
Dim oSelected As Outlook.Selection
Dim oFolderSelected As Outlook.Selection
Dim oItem As Outlook.MailItem
Dim oFldr As Outlook.Folders
Dim oNS As Outlook.NameSpace
'Dim oFldr As Outlook.MAPIFolder
Dim oBackup As Outlook.MAPIFolder

Dim intNumber As Integer
Dim intInspector As Integer

Set oApp = Outlook.Application
Set oExp = oApp.ActiveExplorer
Set oIns = oApp.ActiveInspector

Set oSelected = oExp.Selection


If oSelected.Count 1 Then GoTo exit_outofhere

Set oItem = oSelected.Item(oSelected.Count)
Set oNS = oApp.GetNamespace("MAPI")

oItem.Copy

Set oBackup = oNS.GetDefaultFolder(olFolderInbox)
oBackup.Display
Set oFolderSelected = oIns.Selection
If oFolderSelected.Count 1 Then GoTo exit_outofhere
oFolderSelected =
oNS.GetDefaultFolder(olFolderInbox).Folders.Item(o FolderSelected.Count)
oItem.Move oFolderSelected


exit_outofhe
Exit Sub
End Sub



  #3  
Old November 5th 06, 11:21 PM posted to microsoft.public.outlook.program_vba
rub
external usenet poster
 
Posts: 4
Default trying to copy an email


Thank you.

Dmitry Streblechenko wrote:
Selection is the property of the Explorer object, not Namespace:
Set oFolderSelected = oExp.Selection

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"rub" wrote in message
ups.com...
I am trying to select an email and then copy it. Then I want the Inbox
folder window to appear. I will select a folder and the copy of the
email will be put there. I can't get by the line "Set oFolderSelected
= oIns.Selection". Any ideas



Sub MoveEmail()
Dim oApp As Outlook.Application
Dim oExp As Outlook.Explorer
Dim oSelected As Outlook.Selection
Dim oFolderSelected As Outlook.Selection
Dim oItem As Outlook.MailItem
Dim oFldr As Outlook.Folders
Dim oNS As Outlook.NameSpace
'Dim oFldr As Outlook.MAPIFolder
Dim oBackup As Outlook.MAPIFolder

Dim intNumber As Integer
Dim intInspector As Integer

Set oApp = Outlook.Application
Set oExp = oApp.ActiveExplorer
Set oIns = oApp.ActiveInspector

Set oSelected = oExp.Selection


If oSelected.Count 1 Then GoTo exit_outofhere

Set oItem = oSelected.Item(oSelected.Count)
Set oNS = oApp.GetNamespace("MAPI")

oItem.Copy

Set oBackup = oNS.GetDefaultFolder(olFolderInbox)
oBackup.Display
Set oFolderSelected = oIns.Selection
If oFolderSelected.Count 1 Then GoTo exit_outofhere
oFolderSelected =
oNS.GetDefaultFolder(olFolderInbox).Folders.Item(o FolderSelected.Count)
oItem.Move oFolderSelected


exit_outofhe
Exit Sub
End Sub


 




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
How do I copy calander details to email Pearlo Outlook - Calandaring 1 November 2nd 06 08:43 PM
Can I send a copy of my calendar as an attachment to an email? ikonplayer Outlook - Calandaring 1 April 17th 06 01:44 AM
outgoing email with bcc copy automatically Paul Outlook Express 5 February 26th 06 04:15 AM
Send an email copy to folder [email protected] Outlook - General Queries 3 February 16th 06 03:44 PM
can i get a copy of all emails to my yahoo email address? Arathi Outlook - General Queries 3 January 24th 06 04:17 PM


All times are GMT +1. The time now is 12:52 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.