10/31/2023 0 Comments Outlook print pdf![]() In the code I didn't find a place where Outlook objects declared at the beginning of the functions are declared. Our IT administrators disabled this functionality in Outlook so VBA code calling it does not work. SendKeys "", True ' Press enter to submit/save asĪgain, please do not suggest a solution involving the ".SaveAs" method. SendKeys myDate, True ' Change file name to be saved Set mynetwork = CreateObject("work")ĪppActivate myDialogueTitle ' Activate the printer dialogue window Set olSelection = lectionĪttFullPath = olTempFolder & "\" & olAtt.DisplayName OlTempFolder = olTempFolder & "\emailToPDF-" & myDate MsgBox "There is an error with the specified path. ' Check if path is directory (attribute "16") ' If the path exists, check to make sure path is a directory, else createĭirExists = Dir(olTempFolder, vbDirectory) OlTempFolder = tempPath & "\Outlook Attachments"ĭebug.Print olTempFolder ' Print the folder path to immediate window ' Add Outlook Attachments subfolder to temp path ' Assign the window title of the save as pdf dialogue Skip to the code heading titled, "Print/save email as PDF" to get to the good stuff: Sub saveEmail()ĭim myDate As String: myDate = Year(Now) & Month(Now) & Day(Now) & _ ![]() SaveAsFile as MailItem.SaveAs does not work. I am trying with step 4 to set the save location using a variable then set the filename field using a variable then click save to finish the print process. I think the dialogue is a function of Adobe so finding VBA to talk to the process is hard. I tried finding VBA code that replicates the backend process of the dialogue. I tried AppActivate & SendKeys: the code runs but then it shifts the focus back to the VBE and therefore doesn't do what I need within the print dialogue. I have not found a way to simulate the dialogue box process. Within the dialogue, set the save location and set the filename and submit.A "Save PDF File As" dialogue box appears.I will ctrl+P to print and then select the Adobe PDF as the printer.I will open/select an email that I want to print to PDF.The basic process flow I want to automate: I want to print an Outlook email to PDF using the Adobe PDF (driver?) printer: Please do not suggest any VBA methods that involve ".SaveAs". My company has disabled "save as" functionality in Outlook. ![]() Outlook: Microsoft 365 Apps for enterpriseĪdobe Acrobat Pro DC: version 2022.001.20117 ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |