ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Small application needed (https://www.excelbanter.com/excel-programming/328058-small-application-needed.html)

Tony

Small application needed
 
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



Kaisies

Small application needed
 
Can't help you unfortunatly, but I'd also love to know how to check e-mail
inbox and search for a Subject heading, that would rock :-d

"Tony" wrote:

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




Jim Cone

Small application needed
 
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



Tony

Small application needed
 
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





Kaisies

Small application needed
 
your idea sparked a great interest in me, and It looks like to create
something like this you would need to Use Visual Basic 6, I'm not sure if an
Excel workbook can use Outlook VBA code, and this would be a must.

"Tony" wrote:

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






Tim Williams

Small application needed
 
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







Tony

Small application needed
 
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









Tim Williams

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












All times are GMT +1. The time now is 10:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com