-
what is the best way to populate word specific locations from Excel Data
-
5 Attachment(s)
Hello flora,
Welcome to excelfox
I cannot answer fully your question as I have limited experience with Word VBA, and no experience with charts.
I can give you one short example based on a coding which I use daily. It might give you at least one idea. But it is a bit of a long way around, - Possibly there is a better way to do it. (My way uses a lot of HTML coding , because in daily use I send the final complete text and tables, as seen in the final Word file, as an Email, automatically.)
The coding is a bit rough and patchy, as I have done a quick modified version of an existing coding of mine. I have not explained it all too well. It is intended to give you just a taste of what I can do. If you want to take this further , and provided you are not in too much of a rush, then I can expand on a few things or explain more, etc. over the next few days..
I am using Word 2007 and Excel 2007 for this example.
As a short example, lets say, my Word file looks like this simple text:
Here is my Word File, "WordFile.htm",
WordFile BEFORE.JPG: : https://imgur.com/eyXdoTq
Attachment 2334
I would like to put here Table1.
Here is some other text.
(The Excel file is uploaded for you below. I had to use an external File sharing site, ( app.box.com ) for the .htm File,because that file format will not upload to excelfox . Alternatively download the .docx file below, and resave as .htm from within Word : docx to htm SaveAs.jpg : https://imgur.com/LdHyWst ).
(It simplifies the coding to have this saved with that untypical extension, .htm . But additional coding could allow that to be saved as a normal .doc or .docx Word File)
In an Excel file I have this:
ExcelFile.jpg: : https://imgur.com/G20XRwo
Attachment 2335
_____ Workbook: Excel File.xls ( Using Excel 2007 32 bit )
| Row\Col |
A |
B |
1 |
Table1 Header |
|
2 |
a |
b |
3 |
c |
d |
Worksheet: Tabelle1
The short macro routine example that I give you is also in the above Excel File, "ExcelFile.xls". (The file is uploaded for you below). I also have the total coding that you need here:
http://www.excelfox.com/forum/showth...ll=1#post11386
After running the routine , Sub MakeTagList() , you will get a new Word document, "WordFile2.htm" which looks like this:
WordFile2 AFTER.JPG : https://imgur.com/1QNLExu
Attachment 2336
This is what you need to do for the demo of what is going on:
Download both the files. ( The Excel File and the htm Word File ). Save them anywhere, but make sure they are both saved in the same place. Run the routine , Sub MakeTagList()
The new word doco, "WordFile2.htm" , which is produced, will show shortly for about 5 seconds.
Let me know if you want to take this further.
Alan
Ref:
http://www.eileenslounge.com/viewtop...=29556#p228710
P.S.
I think you may get to a larger audience of more experienced people in the area of automating Word and Excel somewhere else, such as here:
https://www.excelforum.com/word-programming-vba-macros/
http://www.eileenslounge.com/viewforum.php?f=30
(If you post your question elsewhere , then you might want to mention that you already posted the question at excelfox: This is because forums usually have some Rules about "cross posting", which basically means that you must say where else you have posted the same question. http://www.excelfox.com/forum/showth...-Cross-Posters )
Alan
"WordFile.htm" : https://app.box.com/s/xl1l7noo2nf7znnzyz6evqaeiuu37gcz
-
Thank you DocAElstein for your willingness to help. appreciated.
I downloaded the two files. when i run the macro. it only created two htm files and nothing into the word.
-
Hello flora,
I think possibly you may not have fully understood all that I tried to explain. The way I am showing is a bit complicated.
So do this:
_1 When you have time, read again carefully all that I have written in post #2 ( http://www.excelfox.com/forum/showth...ll=1#post11387 ) . One thing that is important to understand is that you need just to have 2 files initially. One is the excel file, "ExcelFile.xls" , and the other is the htm file , "WordFile.htm"
So now:
_2 Delete all the files that you have downloaded so far.
_3 Start again. Download the two files
"ExcelFile.xls" ( It is attached to the posts: ExcelFile attatched to post.JPG : https://imgur.com/lRfKrkD , https://imgur.com/lCcz329 )
"WordFile.htm" ( It is not attached. You must
Either:
Download from here : https://app.box.com/s/xl1l7noo2nf7znnzyz6evqaeiuu37gcz
( Or alternatively;
Download "WordFile.docx" and resave it as "WordFile.htm". ( docx to htm SaveAs.jpg : https://imgur.com/LdHyWst )
Then delete "WordFile.docx" ) )
Both files must be saved in the same place.
You must have initially just two files saved : "ExcelFile.xls" and "WordFile.htm"
_4 Now run Sub MakeTagList()
Remember that I am showing you just one idea. There are probably many other better ways to do what you want to do. But I only know about this one way.
Alan
( P.S: you can open the htm files later using word: Open htm file in Microsoft Word.JPG : https://imgur.com/JorCuQL )
-
-
Quote:
Originally Posted by
flora
Thank you DocAElstein
You are welcome. :)
Good luck with your project.
Alan