NatetheGreat
Active Member
- Joined
- Nov 18, 2013
- Messages
- 268
Hi All,
I expect this may need to go into the "Other Languages" part of the forum, but I'm not entirely certain.
I have the following code within my Outlook VBE
The code is supposed to save the attached spreadsheet into my local disk, naming the file as the subject of the email, but replacing the "/" with "_" so as to be a valid file name for windows. This works in other areas, but for some reason at the moment it is saving the file simply as "FW" and not as xls but as a notepad?
Anyone see something wrong with my code ?
I expect this may need to go into the "Other Languages" part of the forum, but I'm not entirely certain.
I have the following code within my Outlook VBE
Code:
Sub saveattachtodiskspots(itm As Outlook.MailItem)
Dim objatt As Outlook.Attachment
Dim savefolder As String
Dim dateformat
Dim extrabite As String
Dim extrabite2 As String
dateformat = Format(Now, "mmdd H-mm")
savefolder = "C:\Users\USER\Desktop\Daily Reports\spots\"
extrabite = itm.subject
extrabite2 = Replace(extrabite, "/", "_")
For Each objatt In itm.Attachments
objatt.SaveAsFile savefolder & extrabite2 & ".xls"
Set objatt = Nothing
Next
End Sub
The code is supposed to save the attached spreadsheet into my local disk, naming the file as the subject of the email, but replacing the "/" with "_" so as to be a valid file name for windows. This works in other areas, but for some reason at the moment it is saving the file simply as "FW" and not as xls but as a notepad?
Anyone see something wrong with my code ?