Hi Guys, I am trying to create a procedure that will open and save an email attachment. I’m getting a type mismatch on Set myolFolder = olnamespace.GetDefaultFolder("Inbox").
Public Function Get_Attachements()
Dim olapp As Outlook.Application
Dim olnamespace As NameSpace
Dim myItem As MailItem
Dim olatt As Attachment
Dim myapp As Excel.Application
Dim InDate As Date
Set myapp = CreateObject("Excel.Application")
Set olapp = CreateObject("Outlook.Application")
Set olnamespace = olapp.GetNamespace("MAPI")
Set myolFolder = olnamespace.GetDefaultFolder("Inbox")
InDate = Format(Date, mmddyy)
myItem.Subject = "Compiled_RPM_ " & InDate & ".xls"
For Each myItem In myolFolder.Items
If myItem.SenderName = "Varela, Angel" Then
For Each olatt In myItem.Attachments
myItem.SaveAsFile "C:\Mdb\DlrIntntPurchase-Notes\" & "RPMNotes.xls" & ".xls"
Next
End If
Next
End Function
Also are my SUBJECT and FOLDER commans correct? Figured I may as well get as much out the way as I can (smile).
Thanks much,
Trudye
Public Function Get_Attachements()
Dim olapp As Outlook.Application
Dim olnamespace As NameSpace
Dim myItem As MailItem
Dim olatt As Attachment
Dim myapp As Excel.Application
Dim InDate As Date
Set myapp = CreateObject("Excel.Application")
Set olapp = CreateObject("Outlook.Application")
Set olnamespace = olapp.GetNamespace("MAPI")
Set myolFolder = olnamespace.GetDefaultFolder("Inbox")
InDate = Format(Date, mmddyy)
myItem.Subject = "Compiled_RPM_ " & InDate & ".xls"
For Each myItem In myolFolder.Items
If myItem.SenderName = "Varela, Angel" Then
For Each olatt In myItem.Attachments
myItem.SaveAsFile "C:\Mdb\DlrIntntPurchase-Notes\" & "RPMNotes.xls" & ".xls"
Next
End If
Next
End Function
Also are my SUBJECT and FOLDER commans correct? Figured I may as well get as much out the way as I can (smile).
Thanks much,
Trudye