A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Attachments not detected



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 22nd 08, 01:02 PM posted to microsoft.public.outlook.program_vba
Ron_D
external usenet poster
 
Posts: 7
Default Attachments not detected

Hi all,
I've been developing a macro that will look at a subfolder in my inbox and
saves any attachments it finds that meet the criteria. However, enough of my
emails are incorrectly processed when it should have. The macro is telling
me that it's not "seeing" any attachments. Is that possible? Can someone
send an attachment in such a way that Outlook doesn't detect it? Or is it
the codes?

Thanks in advance,
Ron
Ads
  #2  
Old August 22nd 08, 04:09 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Attachments not detected

Since none of us knows what your code is there's no way to answer that.

How are you detecting attachments?

If you iterate the Attachments collection of each item it should return
hidden attachments as well as embedded attachments and normal file
attachments.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Ron_D" wrote in message
...
Hi all,
I've been developing a macro that will look at a subfolder in my inbox and
saves any attachments it finds that meet the criteria. However, enough of
my
emails are incorrectly processed when it should have. The macro is
telling
me that it's not "seeing" any attachments. Is that possible? Can someone
send an attachment in such a way that Outlook doesn't detect it? Or is it
the codes?

Thanks in advance,
Ron


  #3  
Old August 22nd 08, 04:46 PM posted to microsoft.public.outlook.program_vba
Ron_D
external usenet poster
 
Posts: 7
Default Attachments not detected

Here is the code pieced together from discussions in this forum. So thanks
to everyone for the help. Essentially the code should look 4 rules:
1) The subject field should be exactly "ASM Store Photos"
2) The first 4 characters in the attachment's filename should be the store
number, with leading zeros.
3) The attachment's filename MUST contain the date information in
"mm-dd-yyyy".
4) And the file extensions must be .jpg

If all the conditions are met, then it saves the attachments to different
subfolders and toggles the UnRead field to FALSE.

Dim ns As NameSpace
Dim Inbox As MAPIFolder
Dim SubFolder As MAPIFolder
Dim SubSubFolder As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Dim StoreNo As String
Dim y, z As Integer ' Counters.
'Dim tempChar As String ' Letter to evaluate.
Dim DateProper As Boolean ' TRUE/FALSE
Dim AtmtExtProper As Boolean ' TRUE/FALSE
Dim ItemSubProper As Boolean ' TRUE/FALSE

Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
Set SubFolder = Inbox.Folders("Store Photos")
Set SubSubFolder = SubFolder.Folders("Need to save images")
i = 0
' If there are emails, then do this.
For Each Item In SubSubFolder.Items
ItemSubProper = False
DateProper = False
AtmtExtProper = False

' Check for proper subject line heading.
ItemSubProper = False
For y = 1 To Len(Item.Subject)
If Mid$(Item.Subject, y, Len("ASM Store Photos")) = "ASM Store Photos"
Then
ItemSubProper = True
End If
Next y

For Each Atmt In Item.Attachments
' Check date format.
For y = 1 To Len(Atmt.FileName)
If IsDate(Mid$(Atmt.FileName, y, Len("mm-dd-yyyy"))) And
Len(Trim(Mid$(Atmt.FileName, y, Len("mm-dd-yyyy")))) = Len("mm-dd-yyyy") Then
DateProper = True
Exit For
Else
DateProper = False
End If
Next y

' Check file extension.
If Right(Atmt.FileName, 4) = ".jpg" Then
AtmtExtProper = True
End If

StoreNo = Mid$(Atmt.FileName, 1, 4)
FileName = "V:\Users\Store Photos\" & StoreNo & "\" & Atmt.FileName
If (Err.Number = 0) And (ItemSubProper = True) And (DateProper = True)
And (AtmtExtProper = True) Then
Atmt.SaveAsFile FileName
End If
i = i + 1
Next Atmt

If (Err.Number = 0) And (ItemSubProper = True) And (DateProper = True)
And (AtmtExtProper = True) Then
Item.UnRead = False ' Marks email as read when attachments are fully
copied.
End If
Next Item



"Ken Slovak - [MVP - Outlook]" wrote:

Since none of us knows what your code is there's no way to answer that.

How are you detecting attachments?

If you iterate the Attachments collection of each item it should return
hidden attachments as well as embedded attachments and normal file
attachments.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Ron_D" wrote in message
...
Hi all,
I've been developing a macro that will look at a subfolder in my inbox and
saves any attachments it finds that meet the criteria. However, enough of
my
emails are incorrectly processed when it should have. The macro is
telling
me that it's not "seeing" any attachments. Is that possible? Can someone
send an attachment in such a way that Outlook doesn't detect it? Or is it
the codes?

Thanks in advance,
Ron



  #4  
Old August 22nd 08, 08:47 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Attachments not detected

That code will not detect embedded attachments, only attachments attached as
files. However, it would be impossible for an embedded attachment to meet
your requirements, so it makes sense that any wouldn't be detected. Embedded
attachments usually end up with names created by Outlook even if the
original file had a name matching your specs.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Ron_D" wrote in message
news
Here is the code pieced together from discussions in this forum. So
thanks
to everyone for the help. Essentially the code should look 4 rules:
1) The subject field should be exactly "ASM Store Photos"
2) The first 4 characters in the attachment's filename should be the store
number, with leading zeros.
3) The attachment's filename MUST contain the date information in
"mm-dd-yyyy".
4) And the file extensions must be .jpg

If all the conditions are met, then it saves the attachments to different
subfolders and toggles the UnRead field to FALSE.

Dim ns As NameSpace
Dim Inbox As MAPIFolder
Dim SubFolder As MAPIFolder
Dim SubSubFolder As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Dim StoreNo As String
Dim y, z As Integer ' Counters.
'Dim tempChar As String ' Letter to evaluate.
Dim DateProper As Boolean ' TRUE/FALSE
Dim AtmtExtProper As Boolean ' TRUE/FALSE
Dim ItemSubProper As Boolean ' TRUE/FALSE

Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
Set SubFolder = Inbox.Folders("Store Photos")
Set SubSubFolder = SubFolder.Folders("Need to save images")
i = 0
' If there are emails, then do this.
For Each Item In SubSubFolder.Items
ItemSubProper = False
DateProper = False
AtmtExtProper = False

' Check for proper subject line heading.
ItemSubProper = False
For y = 1 To Len(Item.Subject)
If Mid$(Item.Subject, y, Len("ASM Store Photos")) = "ASM Store
Photos"
Then
ItemSubProper = True
End If
Next y

For Each Atmt In Item.Attachments
' Check date format.
For y = 1 To Len(Atmt.FileName)
If IsDate(Mid$(Atmt.FileName, y, Len("mm-dd-yyyy"))) And
Len(Trim(Mid$(Atmt.FileName, y, Len("mm-dd-yyyy")))) = Len("mm-dd-yyyy")
Then
DateProper = True
Exit For
Else
DateProper = False
End If
Next y

' Check file extension.
If Right(Atmt.FileName, 4) = ".jpg" Then
AtmtExtProper = True
End If

StoreNo = Mid$(Atmt.FileName, 1, 4)
FileName = "V:\Users\Store Photos\" & StoreNo & "\" & Atmt.FileName
If (Err.Number = 0) And (ItemSubProper = True) And (DateProper =
True)
And (AtmtExtProper = True) Then
Atmt.SaveAsFile FileName
End If
i = i + 1
Next Atmt

If (Err.Number = 0) And (ItemSubProper = True) And (DateProper = True)
And (AtmtExtProper = True) Then
Item.UnRead = False ' Marks email as read when attachments are fully
copied.
End If
Next Item


  #5  
Old August 22nd 08, 10:26 PM posted to microsoft.public.outlook.program_vba
Ron_D
external usenet poster
 
Posts: 7
Default Attachments not detected

By "embedded" attachments do you mean email items sent as attachments? I'm
not familiar with embedded attachments...sorry.

"Ken Slovak - [MVP - Outlook]" wrote:

That code will not detect embedded attachments, only attachments attached as
files. However, it would be impossible for an embedded attachment to meet
your requirements, so it makes sense that any wouldn't be detected. Embedded
attachments usually end up with names created by Outlook even if the
original file had a name matching your specs.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Ron_D" wrote in message
news
Here is the code pieced together from discussions in this forum. So
thanks
to everyone for the help. Essentially the code should look 4 rules:
1) The subject field should be exactly "ASM Store Photos"
2) The first 4 characters in the attachment's filename should be the store
number, with leading zeros.
3) The attachment's filename MUST contain the date information in
"mm-dd-yyyy".
4) And the file extensions must be .jpg

If all the conditions are met, then it saves the attachments to different
subfolders and toggles the UnRead field to FALSE.

Dim ns As NameSpace
Dim Inbox As MAPIFolder
Dim SubFolder As MAPIFolder
Dim SubSubFolder As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Dim StoreNo As String
Dim y, z As Integer ' Counters.
'Dim tempChar As String ' Letter to evaluate.
Dim DateProper As Boolean ' TRUE/FALSE
Dim AtmtExtProper As Boolean ' TRUE/FALSE
Dim ItemSubProper As Boolean ' TRUE/FALSE

Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
Set SubFolder = Inbox.Folders("Store Photos")
Set SubSubFolder = SubFolder.Folders("Need to save images")
i = 0
' If there are emails, then do this.
For Each Item In SubSubFolder.Items
ItemSubProper = False
DateProper = False
AtmtExtProper = False

' Check for proper subject line heading.
ItemSubProper = False
For y = 1 To Len(Item.Subject)
If Mid$(Item.Subject, y, Len("ASM Store Photos")) = "ASM Store
Photos"
Then
ItemSubProper = True
End If
Next y

For Each Atmt In Item.Attachments
' Check date format.
For y = 1 To Len(Atmt.FileName)
If IsDate(Mid$(Atmt.FileName, y, Len("mm-dd-yyyy"))) And
Len(Trim(Mid$(Atmt.FileName, y, Len("mm-dd-yyyy")))) = Len("mm-dd-yyyy")
Then
DateProper = True
Exit For
Else
DateProper = False
End If
Next y

' Check file extension.
If Right(Atmt.FileName, 4) = ".jpg" Then
AtmtExtProper = True
End If

StoreNo = Mid$(Atmt.FileName, 1, 4)
FileName = "V:\Users\Store Photos\" & StoreNo & "\" & Atmt.FileName
If (Err.Number = 0) And (ItemSubProper = True) And (DateProper =
True)
And (AtmtExtProper = True) Then
Atmt.SaveAsFile FileName
End If
i = i + 1
Next Atmt

If (Err.Number = 0) And (ItemSubProper = True) And (DateProper = True)
And (AtmtExtProper = True) Then
Item.UnRead = False ' Marks email as read when attachments are fully
copied.
End If
Next Item



  #6  
Old August 25th 08, 02:47 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Attachments not detected

If you paste or insert an image or picture in an email so it appears inline
that's an embedded attachment, as one example.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Ron_D" wrote in message
...
By "embedded" attachments do you mean email items sent as attachments?
I'm
not familiar with embedded attachments...sorry.


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
outlook has detected a new account MichaelH Outlook - Installation 0 August 2nd 07 09:56 PM
Hit a Command button and "change" a property of an email to be detected later George Hester Outlook and VBA 3 February 6th 07 07:12 AM
Thunderbird e-mail detected as spam in Outlook 2003. [email protected] Outlook - General Queries 3 November 2nd 06 04:45 PM
Setup detected... ??? c mateland Outlook - General Queries 2 July 23rd 06 07:07 PM
Large mailing list incorrectly detected as worm activity lisalist Outlook - Using Contacts 1 May 18th 06 08:33 PM


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.