Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default default mailbox and moving attachments

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 dont 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Forward in Mailbox Suleman[_2_] Excel Discussion (Misc queries) 4 August 25th 09 03:41 PM
Send as Attachment - Change Default Mailbox? Gar Excel Discussion (Misc queries) 0 August 17th 07 02:24 AM
Excel97 macro to archive Outlook mailbox Geo Excel Programming 0 September 21st 05 09:34 AM
Does anyone know how I can import Eudora mailbox info into Excel . John S. Excel Discussion (Misc queries) 0 December 2nd 04 03:09 PM
Sending spreadsheets through Lotus with a group mailbox Matty[_3_] Excel Programming 1 June 7th 04 07:57 PM


All times are GMT +1. The time now is 09:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"