PC Review


Reply
Thread Tools Rate Thread

default mailbox and moving attachments

 
 
tigoda
Guest
Posts: n/a
 
      28th Feb 2008
I have found whilst look for help the nifty bit of code below,

It comes from a site called (if I remember correctly,) dicks-clicks.com

What it does it looks for files in my mailbox with a certain line in the
subject and moves that email elsewhere whilst at the same time pulling out
the attachment for the email and saving it where ever I want,

What I need to do is figure out how to make it look at another mailbox that
I use.

I was thinking it might be as simple as doing a

Dim mailbox as XZY

Then later on saying:

Mailbox = “reports”

But for the life of me I don’t know what the XYZ bit is nor do I know of
another way to do this. The code for the main bit is:

Dim olApp As Outlook.Application
Dim olNs As Namespace
Dim Mailbox As mapi
Dim Fldr As MAPIFolder
Dim MoveToFldr As MAPIFolder
Dim olAtt As Attachment
Dim MyPath As String

Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")

Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
Set MoveToFldr = Fldr.Folders("reports")

For i = Fldr.Items.Count To 1 Step -1
Set olMi = Fldr.Items(i)
If InStr(1, olMi.Subject, "ERR00") > 0 Then
For Each olAtt In olMi.Attachments

olAtt.SaveAsFile MyPath & Mid(olAtt.Filename, 1, 21) &
".csv"

Next olAtt
olMi.Save
olMi.Move MoveToFldr
End If
Next i

Set olAtt = Nothing
Set olMi = Nothing
Set Fldr = Nothing
Set MoveToFldr = Nothing
Set olNs = Nothing
Set olApp = Nothing
Exit Sub

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving Folder from different mailbox Denis R Charron Microsoft Outlook Discussion 0 29th Jun 2006 11:40 PM
Moving Folder from different mailbox Denis R Charron Microsoft Outlook Discussion 0 29th Jun 2006 11:40 PM
Error when moving mailbox =?Utf-8?B?UlA=?= Microsoft Outlook Installation 2 25th Apr 2006 08:09 PM
Outlook errors after moving mailbox from one mailbox store to another, same Exchange server sally.mcphillips@guidant.com Microsoft Outlook Discussion 0 27th Feb 2006 06:49 PM
Moving mail in mailbox Henry Microsoft Outlook 1 3rd Jun 2005 11:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:57 AM.