Hi,
found this code in the web and changed the path and subject, is there anyway to modify it that it prompts for the subject to type?
code:
Thank you
found this code in the web and changed the path and subject, is there anyway to modify it that it prompts for the subject to type?
code:
VBA Code:
Sub GetAttachments()
Set OlApp = CreateObject("Outlook.Application")
Dim olNs As Outlook.Namespace
Dim Fldr As Outlook.MAPIFolder
Dim olMail As Variant
Dim fsSaveFolder, sSavePathFS, sir() As String
Dim msg As Outlook.MailItem
Dim olAttach As Attachment, olItem As MailItem
Set OlApp = New Outlook.Application
Set olNs = OlApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
Set myTasks = Fldr.items
fsSaveFolder = "C:\Attachments\New\"
Set olMail = myTasks.Find([B][COLOR=rgb(226, 80, 65)]"[Subject] = ""Long Distance""")[/COLOR][/B]
ThisEmails = myTasks.Count
If Not (olMail Is Nothing) Then
ThisAttachments = olMail.Attachments.Count
ThisEmails = myTasks.Count
ThisFileName = olMail.Attachments(1).Filename
While olMail <> "Nothing"
'Save attachment to drive
olMail.Attachments(1).SaveAsFile fsSaveFolder & olMail.Attachments(1).Filename
'Move email to Outlook folder
Set Fldr = Outlook.Session.Folders("Holloway,James").Folders("Conference")
olMail.Move Fldr
Set olMail = myTasks.FindNext
If olMail Is Nothing Then
Exit Sub
End If
Wend
End If
End Sub
Thank you