Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

VBA code to VBS file

$
0
0
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
Attached Images
 

Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>