controljnr.blogg.se

Outlook save as pdf
Outlook save as pdf








PdfSave = Format(oMail.ReceivedTime, "yyyy-mm-dd-hhmm") & "_" & emailSubject & "_" & looper & ".pdf" SaveName = Format(oMail.ReceivedTime, "yyyy-mm-dd-hhmm") & "_" & emailSubject & "_" & looper & ".mht" SaveName = Format(oMail.ReceivedTime, "yyyy-mm-dd-hhmm") & "_" & emailSubject & ".mht"ĭo While fso.FileExists(bPath & saveName) StrText = Replace(strText, Mid(strStripChars, i, 1), "") '# If Mail Attachments: clean file name, save into path #ĪtmtSave = bPath & Format(oMail.ReceivedTime, "yyyymmdd") & "_" & atmtNameįunction CleanFileName(strText As String) As String SaveName = Format(oMail.ReceivedTime, "yyyymmdd") & "_" & emailSubject & "_" & looper & ".txt"Įlse '# If don't overwrite is off, delete the file # Set fso = CreateObject("Scripting.FileSystemObject")ĭo While fso.FileExists(yPath & saveName)

outlook save as pdf

SaveName = Format(oMail.ReceivedTime, "yyyymmdd") & "_" & emailSubject & ".txt" '# Get Email subject & set name to be saved as #ĮmailSubject = CleanFileName(oMail.Subject) 'If Dir(mPath, vbDirectory) = vbNullString Then 'Make sure month path exists (uncomment below lines to enable) 'If Dir(yPath, vbDirectory) = vbNullString Then 'If Dir(cPath, vbDirectory) = vbNullString Then If Dir(bPath, vbDirectory) = vbNullString Then MPath = yPath & Format(Now(), "MMMM") & "\" 'Add month subfolder YPath = cPath & Format(Now(), "yyyy") & "\" 'Add year subfolder Change the yPath variable to mPath in other areas of the script to enable the month folder.īPath = "C:\email\" 'Defines the base path to save the emailĬPath = bPath & companyDomain & "\" 'Adds company domain to base path

outlook save as pdf

'# THIS IS WHERE SAVE LOCATIONS ARE SET # Set olNS = Application.GetNamespace("MAPI")ĬompanyDomain = Right(sendEmailAddr, Len(sendEmailAddr) - InStr(sendEmailAddr, # USER OPTIONS #īlnOverwrite = False ' False = don't overwrite, True = do overwrite

outlook save as pdf

' Also requires reference to Microsoft Word Object Library ' requires reference to Microsoft Scripting Runtime There can be up to ten emails and attachments with the same names. I need both the email and the attachments to loop through 1-10. When there are multiple emails with the same name and also if the attachments have the same name they overwrite each other. I save incoming mail with an inbox rule and VBA code.










Outlook save as pdf