Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Modify VBS Script for Outlook (http://www.outlookbanter.com/outlook-vba/67659-modify-vbs-script-outlook.html)

Massimo[_2_] February 27th 08 02:06 PM

Modify VBS Script for Outlook
 
Hi,
I find at this link:
http://www.microsoft.com/italy/techn.../tips0809.mspx
a script to save all the outlook attachment in a folder, the script is:

--------------------------------------------------
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set colItems = objFolder.Items
For Each objMessage in colItems
intCount = objMessage.Attachments.Count
If intCount 0 Then
For i = 1 To intCount
objMessage.Attachments.Item(i).SaveAsFile "C:\Temp\" & _
objMessage.Attachments.Item(i).FileName
Next
End If
Next
--------------------------------------------------

My problem is that I would like to save only the attachment of a specified
sender and not all,
anyone help me to modify the script ?

Thank you very much !



Ken Slovak - [MVP - Outlook] February 27th 08 02:28 PM

Modify VBS Script for Outlook
 
How would this sender be identified? Is it someone in an existing contact
item, or based on the sender name or sender email address? What version of
Outlook? Where is this script running, is it in Outlook?

--
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


"Massimo" wrote in message
...
Hi,
I find at this link:
http://www.microsoft.com/italy/techn.../tips0809.mspx
a script to save all the outlook attachment in a folder, the script is:

--------------------------------------------------
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set colItems = objFolder.Items
For Each objMessage in colItems
intCount = objMessage.Attachments.Count
If intCount 0 Then
For i = 1 To intCount
objMessage.Attachments.Item(i).SaveAsFile "C:\Temp\" & _
objMessage.Attachments.Item(i).FileName
Next
End If
Next
--------------------------------------------------

My problem is that I would like to save only the attachment of a specified
sender and not all,
anyone help me to modify the script ?

Thank you very much !



Massimo[_2_] February 28th 08 07:33 AM

Modify VBS Script for Outlook
 
How would this sender be identified? Is it someone in an existing contact
item, or based on the sender name or sender email address? What version of
Outlook? Where is this script running, is it in Outlook?


Hi,
I would like to identify the sender by email address or display name, the
script
run on my desktop (external Outlook), my version of Outlook is 2003.

Thank you very much.



Ken Slovak - [MVP - Outlook] February 28th 08 02:40 PM

Modify VBS Script for Outlook
 
In Outlook 2003 you can use the MailItem.SenderName and
MailItem.SenderAddress properties. Once you get each mail item in the loop
use those properties:

For Each objMessage in colItems
If ((objMessage.SenderName = "Joe Fubar") OR _
(objMessage.SenderAddress = ")) Then

' do whatever with this one
End If

--
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


"Massimo" wrote in message
...
How would this sender be identified? Is it someone in an existing contact
item, or based on the sender name or sender email address? What version
of Outlook? Where is this script running, is it in Outlook?


Hi,
I would like to identify the sender by email address or display name, the
script
run on my desktop (external Outlook), my version of Outlook is 2003.

Thank you very much.



Massimo[_2_] March 3rd 08 08:06 AM

Modify VBS Script for Outlook
 

MailItem.SenderAddress properties. Once you get each mail item in the loop
use those properties:

For Each objMessage in colItems
If ((objMessage.SenderName = "Joe Fubar") OR _
(objMessage.SenderAddress = ")) Then

' do whatever with this one
End If



Thank you very much but I'm ignorant about VBS :-)
how can I modify the script with the new option ?

--------------------------------------------------
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set colItems = objFolder.Items
For Each objMessage in colItems
intCount = objMessage.Attachments.Count
If intCount 0 Then
For i = 1 To intCount
objMessage.Attachments.Item(i).SaveAsFile "C:\Temp\" & _
objMessage.Attachments.Item(i).FileName
Next
End If
Next
--------------------------------------------------

Best Regards






Ken Slovak - [MVP - Outlook] March 3rd 08 01:50 PM

Modify VBS Script for Outlook
 
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set colItems = objFolder.Items
For Each objMessage in colItems
intCount = objMessage.Attachments.Count
If intCount 0 Then
For i = 1 To intCount
If ((objMessage.SenderName = "Joe Fubar") OR _
(objMessage.SenderAddress = ")) Then

objMessage.Attachments.Item(i).SaveAsFile "C:\Temp\" & _
objMessage.Attachments.Item(i).FileName
End If
Next
End If
Next

You have to substitute the actual name and email address you want of course.

--
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


"Massimo" wrote in message
...

MailItem.SenderAddress properties. Once you get each mail item in the
loop
use those properties:

For Each objMessage in colItems
If ((objMessage.SenderName = "Joe Fubar") OR _
(objMessage.SenderAddress = ")) Then

' do whatever with this one
End If



Thank you very much but I'm ignorant about VBS :-)
how can I modify the script with the new option ?

--------------------------------------------------
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set colItems = objFolder.Items
For Each objMessage in colItems
intCount = objMessage.Attachments.Count
If intCount 0 Then
For i = 1 To intCount
objMessage.Attachments.Item(i).SaveAsFile "C:\Temp\" & _
objMessage.Attachments.Item(i).FileName
Next
End If
Next
--------------------------------------------------

Best Regards



sreedhar May 14th 08 10:44 AM

Modify VBS Script for Outlook
 
Hi there,

how to get the body message for a sender.

Thanks,
Sreedhar

url:http://www.ureader.com/msg/10813327.aspx


All times are GMT +1. The time now is 03:36 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-2006 OutlookBanter.com