Copy data from Excel to Word - excel

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.

Related

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.

Generating Word financial statements from Excel workbooks

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.

Data Copy using Excel-VBA

I am having a folder of 10 excel-based CSV files. Is there any method to copy the data from all these files into 1 excel
Not good with VBA, so thought to ask you guys
On a first sight, I would go for the following approach (coming up with the codes is up to you, Google is your friend):
Get a list of all file names within that directory
Iterate over every item from the above list and open the file with Workbooks.Open(...)
Copy the whole content and paste it to the additional Excel you want to manage to hold the data of all files
Repeat the steps for each file
Remember to save the last row after every paste s.t. you can continue with amending the data into the addtional Excel instead of replacing the content.

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.

Copy web content from Outlook to Excel using VBA

My client receives an email with a one-time-access url each day (it can only be accessed once, and only on that day).
Content from this url is plain text formatted as a .csv (actually tilda sv) file, but that is not of relevance here.
The content is then (manually) copied and pasted into Excel sheet, where some (formatting) macros are applied (to get rid of tildas and put data into cells).
Also, few of the first rows of the content are irrelevant, i.e. only lines 5-end are copied into Excel.
My question is the following - is it possible to write a VBA in Outlook to
open the url provided in the given email
copy the content from the webpage (and remove those first couple of lines)
open Excel and paste it there (and apply formatting afterwards)
I found some answers on how to copy/paste content from the email itself into Excel sheet, but didn't manage to sort out how to do it from a url/webpage.
Yes it is possible
I am not expert on VBA, but I do little programing to reduce daily task
I can show you the steps:
create rule that triggers VB script when email arrives.
In the VB script in the outlook, write code that would open excel
pass the connection string
set the R1C1 as destination cell
Save the file as date variant .xls
Make sure outlook is open. This would not work if outlook is not open

Resources