LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Programing Outlook using Excel

I am using Outlook 2000 with Excel 97

I have been experimenting with code found at
http://www.dicks-clicks.com/excel/olAutomating.htm
I use the code to loop through emails in the Inbox, save the attachment, run
code to paste information into two workbooks, and then move the email to
another folder.

My modified code is working, but now I need to make sure that the emails in
the inbox are grouped by subject before saving the attachments (the emails
must be processed in date order and the date is part of the subject line).
Several people use this machine and can change the grouping.

I would appreciate any help if it is possible to change the grouping in
Outlook from code in excel. I have also listed the code I am using below.
Thanks
Valerie

Sub OpenAttachment()
'My testing to open the attachment and run macro then
'move to another folder
Application.EnableEvents = False
Dim olApp As Outlook.Application
Dim olNs As NameSpace
Dim Fldr As MAPIFolder
Dim MoveToFldr As MAPIFolder
Dim olMi As MailItem
Dim olAtt As Attachment
Dim MyPath As String
Dim i As Long

Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
Set MoveToFldr = Fldr.Folders("Daily Sales")
MyPath = "C:\My Documents\Test\Daily Sales.xls"
For i = Fldr.Items.Count To 1 Step -1
Set olMi = Fldr.Items(i)
If olMi.Subject Like ("Daily Sales *") Then
For Each olAtt In olMi.Attachments
If olAtt.FileName = "Store Register Email v20.xls" Then
olAtt.SaveAsFile MyPath
Workbooks.Open FileName:=MyPath

'calls macro that copies information to correct workbooks
Call ToDailyRegister

End If
Next olAtt
olMi.Save
olMi.Move MoveToFldr
End If
Next i
Kill MyPath
Set olAtt = Nothing
Set olMi = Nothing
Set Fldr = Nothing
Set MoveToFldr = Nothing
Set olNs = Nothing
Set olApp = Nothing
Application.EnableEvents = True
End Sub


 
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
excel question borderline programing gimp New Users to Excel 1 June 25th 06 06:01 AM
excel programing rlenz Excel Discussion (Misc queries) 2 April 18th 06 02:41 PM
Excel Programing / VBE - Good Books? jimredfield[_3_] Excel Programming 4 October 11th 03 07:45 PM
help with excel programing drummerboy827[_4_] Excel Programming 1 September 27th 03 03:31 PM
Excel Programing Resources Kirk[_3_] Excel Programming 2 August 8th 03 08:01 PM


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

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

About Us

"It's about Microsoft Excel"