LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Small application needed

Tony,

1. I don't have Outlook Express, so I've only run this with Outlook.
2. I'm using Excel XP (2002?) and haven't tested on any other version. You
don't mention what version of Excel you have. What happened when you tried
to run the code?
3. I'd suggest posting to an Outlook programming group for this, although
I'm sure the answer is already available (try google groups search). In any
case I've no doubt it can be done.

If you're stumped then I may be able to help you offline: mail me at
saxifrax at the domain pacbell dot net.

Cheers
Tim

--
Tim Williams
Palo Alto, CA


"Tony" wrote in message
...
Dear Tim,

Thank you for your reply.

1. I assume that the code only works with Outlook, not Outlook Express ?
2. What version on Excel is needed ? It doesn't run with the VB in the

copy
I have.
3. Do you know how to copy the text from the appachments and append it to
the archive file? Can the data in the attachments be appended to a single
file "C:\QS\QSdata.txt" ?

Many thanks for your help.

Tony


"Tim Williams" <saxifrax@pacbell*dot*net wrote in message
...
Tony,

Try this code - it should scan your Outlook inbox for any mails with
the required subject, process them (no code for that, so maybe you can
fill in there...) and move them to a "Processed" folder in the inbox.

Add a reference to the outlook library in your VBA project.

Tim.


Sub GetOutlookMessages()

Const S_SUBJECT As String = "QSData"
Const ARCHIVE_FOLDER As String = "Processed Mails"

Dim olApp As Outlook.Application
Dim fInbox As MAPIFolder
Dim olFolderArchive As Object
Dim olInboxCollection As Object
Dim olInboxItem As Object
Dim iCount As Integer
Dim l
Dim t
Dim itemCount, i, n

On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If olApp Is Nothing Then
MsgBox "Outlook is not running: please open the application
first"
Err.Clear
Exit Sub
End If
On Error GoTo 0

'On Error GoTo haveError

'Get the inbox folder
Set fInbox =
olApp.GetNamespace("MAPI").GetDefaultFolder(olFold erInbox)
Set olInboxCollection = fInbox.Items

itemCount = olInboxCollection.Count

'Look for archive folder.
For i = 1 To fInbox.Folders.Count
If fInbox.Folders.Item(i).Name = ARCHIVE_FOLDER Then
Set olFolderArchive = fInbox.Folders(i)
Exit For
End If
Next i

' Add archive folder if it does not exist.
If olFolderArchive Is Nothing Or fInbox.Folders.Count = 0 Then
Set olFolderArchive = fInbox.Folders.Add(ARCHIVE_FOLDER,
olFolderInbox)
End If

iCount = 0
t = Timer

For n = itemCount To 1 Step -1
Set olInboxItem = olInboxCollection(n)

If StrComp(olInboxItem.Subject, S_SUBJECT) = 0 Then

iCount = iCount + 1
Application.StatusBar = "Processing # " & iCount

'here's where you get the info from the attachment....


'move the item to the "dealt with" folder
olInboxItem.Move olFolderArchive

End If
Next n

haveError:
If Err < 0 Then MsgBox "Error:" & vbCrLf & Err.Description
Application.StatusBar = False

End Sub





"Tony" wrote in message
...
Jim,

I want to process the appended file using Excel.

Tony


"Jim Cone" wrote in message
...
This is an Excel group, so email inbox scanning is not a
much discussed issue. However, this might get you started?...

http://www.xtware.com/filenotify/index.html

Jim Cone
San Francisco, USA


"Tony" wrote in message
...
I need a small application to be developed that :

1. Scans email inbox, for messages with the subject "QSData" (or
title
read
from ini file)
2. Reads the attachment to these messages. The attachment is a
text
file
with several lines of data.
3. Appends the data from the attachment to a file "QSdata.txt"
(or file
name
given in ini file)
4. Asks if the user wishes to delete the messages in the inbox
with
subject
"QS Data"

Can anyone help please?

Thank you,

Tony










 
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
ISERROR,SMALL,INDEX, MATCH, SMALL?? M.A.Tyler Excel Discussion (Misc queries) 1 May 2nd 07 04:08 AM
Using Small PH NEWS Excel Worksheet Functions 2 July 27th 06 09:22 AM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM
SMALL(?) Beto[_3_] Excel Programming 9 February 3rd 04 06:09 PM
application.quit will not shut off application john Excel Programming 0 January 9th 04 11:29 PM


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