Hi
I have a vba code in Outlook for saving attached pdf files to a folder. but I want to run the code in a vbs file insted. if I just cpoy the code to notepad and save it to a vbs i get the follow error code when i got e-mail
![Name: error.png
Views: 71
Size: 8.6 KB]()
the VBA code is following
Sub filetransfer(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim dateFormat
dateFormat = Format(Now, "yyyymmdd")
saveFolder = "D:\Hotfolder"
For Each objAtt In itm.Attachments
If InStr(objAtt.DisplayName, ".pdf") Then
objAtt.SaveAsFile saveFolder & "\" & dateFormat & " " & objAtt.DisplayName
End If
Next
End Sub
I have a vba code in Outlook for saving attached pdf files to a folder. but I want to run the code in a vbs file insted. if I just cpoy the code to notepad and save it to a vbs i get the follow error code when i got e-mail
the VBA code is following
Sub filetransfer(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim dateFormat
dateFormat = Format(Now, "yyyymmdd")
saveFolder = "D:\Hotfolder"
For Each objAtt In itm.Attachments
If InStr(objAtt.DisplayName, ".pdf") Then
objAtt.SaveAsFile saveFolder & "\" & dateFormat & " " & objAtt.DisplayName
End If
Next
End Sub