Generating Word financial statements from Excel workbooks - excel

I am trying to generate a Word document that consists of Excel information. When the Excel document updates I would like for the Word document to do the same.
I have managed to setup a template in Excel which carries over the information into Word seamlessly. The formatting is still a struggle though and if the Excel document changes I need to reproduce the whole Word doc from scratch again.
I am wondering whether it is possible to create the template in Word and "connect" it to the Excel (as the underlying information) easily using VBA?
What are some of the best practices or suggestions to try and go about doing something like this.

In Word, on the Insert tab, look at Insert Object. You have the option of inserting / linking part of the contents an Excel worksheet in the Word document. Once linked, whenever you open the Word document, its contents is automatically refreshed with the latest contents from the linked Excel worksheet.
The only thing that you have to be careful about with this solution, is that if you move your Excel files with respect to the Word document (to another folder), then when you open the Word document, Word will not be able to find the Excel documents. When implementing a solution like this, both the Word document and the linked Excel documents are typically kept / copied / moved together.

Related

Link in Microsoft Word, from a separate Excel file, ruins formatting when "update link" is hit

I have two workbooks. One is Microsoft Word, one is Microsoft Excel. The excel sheet is the model, and the word doc is the report (so formatting is important). I have values in excel that, when updated, I want to update also in the word doc while keeping the formatting.
I know that I can paste special, and I've tried both "merge formatting" and "keep source formatting". That only seems to affect the text itself, and not the layout of the text in the document.
Currently, this is what happens when I hit update link:
Before
After
I want to keep all the text where it is in the document, not have it relocated to new, separate lines every time the link is updated.
Thanks!

Edit word document through excel

i am trying to have VBA open up a specific word document (this document is protected but has boxes where you are able to edit text). i will then need to fill out said word documents editable areas with variables in the excel document. i have no idea where to start with this code and was posting to see if this is possible and how i could do it.
Additional note. Would it be easier to have vba create a whole new word document in the code so it can just add in all the text?
Since there isn't any code. I'm not sure what stage you're at in this but, from how I read your question you have two ways to do this. Either have your vba code in the word document that opens an Excel file to read cells or have the excel document create a word document with information already filled out. I would recommend using Word to read Excel.
This Question has information about setting fill-able values in Word. There are also a lot of resources out there to find out how to get cell values and open excel documents using VBA.
All this being said. I would say you should probably look for alternatives to all of this. Such as powerapps connecting to an excel file or change your excel file to a SQLExpress database to use that in finding data. The reason I recommend this is because it's much more scalable.

Amending a text file in Sharepoint via Excel VBA

I have an Excel spreadsheet on a Sharepoint site that I would like to keep as read-only. However, my users will occasionally need to add small amounts of data, which I thought could be best stored in a small text file. I can read the text data into the Excel userform easily enough, and I can amend the text file with new data equally easy - but only if I have already checked the text file out. This doesn't work for other users of course. Is there some method of checking out a file - which isn't a workbook - out via Excel VBA, or will I have to switch to storing the updateable data in another workbook?
It is possible to use VBA to read textfiles. You can use this example for instance: https://www.excel-easy.com/vba/examples/read-data-from-text-file.html where you can read the data per line.

Populate word template from excel vba

On this discussion it is well explained how to populate Word Templates from excel data using Bookmarks on Word.
In my case, I need to populate the template as many times as the Excel's rows are.
Attached you can find an example. Sorry if I don't add any VBA draft code, but I don't have any idea of how to set it up.
The excel table is:
The word template is:
And the result should be:

Copy data from Excel to Word

I have a .csv file which I can export and from which I need to copy data into word.
I know how to get the relevant data from Excel and format my .csv file with VBA, however I don't know how to get my data from that Excel file to Word.
Basically this is how a line of my formatted .csv file looks (I Got rid of all the info I don't need).
For clarification: 1st long nr. is personnel 2nd one is token.
And I need to fill that info into the following table in word (Not everything gets filled in).
And one extra thing, depending on the extention of the email address #mc or #lmc, I need a different file opened (Different languages). How would I best do that?
Possible algorithm:
In your Excel document, develop a VBA macro that
Copy data/elements from Excel document
Open your word document
Paste excel data to word document (to the places you want)
Save word document
Close word document
Here is some code for inspiration of how to do that.

Resources