So, I have created a script/workbook for generating multiple invoices along with the meta data required by a piece of software we have built.

Basically the metadata contains receipt/PO and supplier data, and pushed out to five different CSV files. So this all works fine.

The next stage is taking information from the workbook and mail merging into a number of invoice layouts. I have 13 Layouts (so far) as 13 separate docx files, each time the VBA script is run, it create a number of each of these layouts using the generated data, splits them into separate documents and converts them to PDF. Now here is where my problem is, and i assume its something to do with how i've initialised the word document/application. If i select more than ~4 layouts (the user can choose how many layouts they want) i get the "microsoft excel is waiting for another application to complete an ole action" Error. My working theory is that i am no closing word down after each merge is carried out.

Initialised>>Generate metadata>>export CSV Master Data files>>Merge invoices into single word document>>split Document>>Convert to PDF

Below is the mail merge portion of my code, and this may simply be my inexperience with VBA and doing something wrong, but any help would be great.

Please Login or Register  to view this content.