Mail Merge with attachments using Power Automate: Creating Manual Flow - pdf

I have been to create a manual flow using Power Automate to complete the following task:
Send an email to a specific recipient with a corresponding pdf attachment.
I have to repeat this task over 150 times since I have a list of recipients.
After watching a few tutorials and experimenting with Power Automate, I was able to create a manual flow to send an email to everyone from my list (Excel File) but I am struggling to figure out how to attach a unique PDF file with each email going out to these recipients.
For my input items, I have:
An excel file with names, email addresses, and the pdf files names
(not the actual attachment, just the name of each file). The file is stored in
OneDrive.
A folder containing all of the PDF files with unique names
(matching the names in the excel file). This folder is stored in
OneDrive.
Basically, what I am attempting to do with the flow is to:
Grab the name of the recipient
Email address
Name of the pdf file
Attach a copy of the pdf file
Send the email with the attachment.
The flow will loop across all the rows in my excel table and complete the actions above until the list is exhausted.
I am sure this can be done in some way in excel but I figured Power Automate can be much more efficient, or maybe any other alternatives that you can suggest.
Thank you in advance for taking the time to read this and sharing some insights.

Related

Word macros disappear on transfer

I'm using Word 2019 and have created macros I want to send to other organisations.
However, when I transfer the document (.docm) or the template (.dotm) the recipient doesn't get the macros (although everything else goes across). On the Developer ribbon, there is no entry for the macro itself or the VBA code.
I know I can export the macro to a *.bas file which the recipient can then import but I'd like to do it directly.
There is no problem with transferring Excel macros but I can't get Word to work.
Can anybody help?
This is most likely to have 2 possible reasons:
Did you really choose "Word Macro-Enabled Document" as file format? It could be that you saved a normal "Word Document" with the file extension .docm. Note that the file extension does not defined the file format.
If this happend you have actually a Word document (without macros) but with the wrong file extension .docm. Make sure you choose the correct format not only the correct extension.
You can easily test this:
Save your file as macro enabled file docm.
Close Word completely.
Re-Open your file. If the macro is still there your file format is correct.
If you send your file via email it can be that your recepient does not allow to recieve macro enabled files, and his email server is stripping off the macro from the Word file.
If this is the case, then you cannot do much to prevent this. It is in the responsibility of the recepient. The only way to get through this kind of filter is to pack your file into a password protected zip archive so the email server cannot access the Word file. But not that doing so can violate the recepients policies. Also if the reciepient's company did it right they won't allow password protected zip archives via email because the could tunnel through their email filters.
Best solution in this case it to provide the file via some cloud share (Google Drive, Dropbox, One Drive, what ever, …) and send the recipient a link only.
That is because of your AV blocking macros to be saved in your PC. Macros have been used in the past by threat actors and Microsoft has applied a protection to them.
When you edit a document with macros, word creates a hidden file which is the macro you are running, now when you try to save that file, it gets caught by AV. Since AV thinks it is an evil activity. It gets saved on your system because your directory is now a Trusted Location and it is okay.
A workaround is to install Windows 7 with Microsoft Office 2007 to get what you want since Windows 7 has little to no security.
Thanks

MS Word macro to search for and combined specific files into one document

I have encountered a stumbling block that exceeds my experience in working with MS Word macros. Until recently, I have not had much need to use macros in Word or Excel, and what little bit I have needed was completely internal to the document or spreadsheet.
Now I find myself needing guidance on creating a macro that will draw on external files to create a temporary new file.
Within a working folder, I have a Master Document and numerous daughter documents. The daughter documents all have file tags/keywords.
What I need is protected document (it can be DOC, PDF or HTML) that when opened will run a macro that will (1) query the user for a search term, (2) search all the files in the folder for file tags or keywords that match (3) open all those matching files into a single html page for display.
All the source files are Word 2010 but can be saved as PDF or HTML if it makes things easier.
Thanks in advance.
Word's Master Document 'feature' is a disaster waiting to happen! Use it only if you don't value your work. See:
https://wordmvp.com/FAQs/General/WhyMasterDocsCorrupt.htm
http://www.addbalance.com/word/masterdocuments.htm
As for opening all your source documents in a single window, that's not possible unless you actually merge those documents into a single file. The code for that is complex. For some code to get you started, see:
https://www.mrexcel.com/forum/general-excel-discussion-other-questions/1037570-vba-combine-differently-formatted-word-files-into-1-while-preserving-layouts-post4980503.html#post4980503

Excel, vba, and onedrive or sharepoint file sharing

I have two local excel files on my hard drive. Both have Macros to achieve certain goals. But after all being done the end result is that after i click a command button from one excel file (lets call it 'A') the data gets transferred based on a macro behind that command button to the other file (let call this one 'B') in a certain format.
All this works great. The source file 'A' is accessible by everyone to enter data, but the destination file to maintain data integrity is read only but a macro is able to write into it. For obvious reasons, both file are on a shared folder so data can be entered one file and transferred to another by everyone.
Now I want to be able to continue with the same functionality but now on a sharepoint or onedrive. Unfortunately I am unable to do so.
I am not sure what are your exact requirements, however I think you can use SharePoint lists with SPD workflows to meet your requirements instead of using excels.
Whenever business users need data in excel they can always export them from list.
There is one more easy way where you can let users enter data in excel however it will be stored in SharePoint list.

Running Mail Merge on Embedded Document in Word

I am looking for code that will open all embedded documents within a Word document, update the mail merge info, and close the file again.
Here's the story: I have about twenty documents that contain instructions on how to get access to various systems. These documents are role-specific—meaning that depending on the user's needs, these instructions vary from document to document.
At the present, anytime a system changes their access procedures, I have to go into each of the twenty documents and update the necessary information. I have been working on a solution to improve the workflow but have hit a little snag.
I have created system-specific documents that contain the information to access the individual systems. I have then embedded these system-specific documents into the original role-specific documents. This has the desired effect—I am able to manipulate information in the system access document and it will update information in the documents for all the necessary roles.
That part isn't the snag. This is the snag. In each system access document, I have a mail merge running that puts in role specific data (i.e., login info, role, department, etc.) The mail merge collects information from a master user excel file.
The overall effect here would be that I can input user data into the user excel file, open the role-specific instructions needed for that user, and have all the embedded documents already run the updated mail merge info without having to open each system-specific document and updating the mail merge info.
I am looking for code that will open all embedded documents within a Word document, update the mail merge info (this generally occurs upon the file opening), and close the file again.
If anyone can help with this little scenario, or if anyone has a much more better idea that would work, please let me know.

VB.net text -> Excel conversion (with extensive formatting required after conversion)

I'm creating a program in VB.net that does the following:
At a high level I receive a file in email, put the attachment in a monitored folder, import the text file to excel, format the excel, and then email the excel file to a list of recipients.
Here is my plan:
Completed: Outlook VBA to monitor all incoming email for specific message. Once message is received drop attached .txt file in a specific network folder.
Completed: (VB.net) Monitor folder, when text file is added begin processing
Not Complete: (VB.net) Import text file to Excel
Not Complete: (VB.net) Format Excel Text file. (add in a row of data, format column headers with color/size, add some blank columns, add data validation to some of the blank columns that allow drop down selections)
Completed: (VB.net) Save file.
Completed: (VB.net) Send file to list of recipients.
Obviously the items above that are not complete are the bulk of the work, but I wanted to get some advice on what some of you think would be the best way to approach something like this. The import and formatting of the file are causing me some problems because I just can't decide what would be the most efficient way to do this.
What I've thought of so far:
The way stated above. Import to excel -> format
Having a template excel that contains all of the formatting already done for me and attempting to transition the data to this document (no clue if/how I can do this). Is it even feasible? Have the template already created and then import the text file to a new excel file, then transition that data to the excel template?
Something I thought about, in terms of formatting the document, was to record a macro of me doing all of the formatting that I'm going to need and then attempt to convert that macro into my vb.net code, but I'm not sure if that will work. I will need to verify that the text file comes in the EXACT format every time correct?
I really appreciate any advice/suggestions that anyone is willing to give.
You will want to use http://epplus.codeplex.com/
It allows you to create an Excel file from scratch, without having to start Excel itself. Automating Excel will make the process slow and it lacks robustness (Excel process can hang or not close properly).
In addition, using a .Net library allows you to run it on a server or so where no Excel is installed. (Next step would be to inspect the mailbox via POP, IMAP or the Exchange API, so that part doesn't have to be run on a client machine either)
http://msdn.microsoft.com/en-us/library/kh3965hw(v=vs.100).aspx
You can also just use the Interops from MS to interact with Excel, Outlook, Word, etc. They're not difficult at all to use. I'm not familiar with CodePlex, so that may be a better route or an easier one. I just wanted to provide you with an alternative.
With Microsoft Office 2010 Interops you can not generate Office files from .net applications anymore.
You can manipulate data from existing Excel files so you need templates(your 4th point). Then Excel allows you to query some databases. You may be able to simulate one with your folder, otherwise I suggest to convert your .txt files into some databases. (3rd point)
If you do use an older version, you can crate your Excel files by loading them into an instance of Excel and manipulating them as you wish.
By the way I supposed your attached files would have some sort of format.
If you want to manipulate Excel files, I can recommand you the NPOI library found on CodePlex. It has several advantages over OLE-automation:
NPOI is not dependent on a specific Excel version.
Excel (or any other Office component) need not to be installed.
It is faster.
It works with both .XLS and .XLSX files.
We are using a third party software called excel writer. May not be what you are looking for becauseit needs to be license, but it is very fast and the clients does not have to wait for a chart or a data output. Because we have that tool, have not try anything else.