PDA

View Full Version : excel cells to word bookmarks



Luis Otavio
01-11-2013, 10:04 AM
Hi,

I have a macro to generate reports (.doc). I would like to add a script that Word bookmarks seek cells values in a excel file. For each report I will need different cells, but for this I will do a looping.

Whatīs the script that a bookmark of my template will get a cell value in excel?

Thanks!!

fumei
01-11-2013, 06:03 PM
Have you done any kind of search for this? It is a common request and there a number of examples out there.

Luis Otavio
01-11-2013, 06:16 PM
Yes, I searched a lot. but all the examples were in excel and did not fit to my case.

fumei
01-11-2013, 11:38 PM
Really? I am sceptical. But OK, please state exactly what your case is. Please be very specific and explicit; give a step-by-step description of what you want to happen.

Luis Otavio
01-12-2013, 12:11 PM
OK, thanks!

I have a word macro that take some graphs and insert them at bookmarks. And the macro does it in my template generating 425 reports. At the same macro, I need to create a routine to insert numbers (Cells) of a spreadsheet.

In my spreadsheet, I have 425 lines, each one will be related with a report. For each report I have 10 variables, and each one has 3 values (the city value, the region value and the country value).

What I need:

a script to take cells value in a Excel file. In just one file, there is all data I will need. The cells will not be fix for reports.
For each report I will have 30 bookmarks that will insert the numbers in my text.

I just need the code to open a excel file and put a cell value in a bookmark.

thatīs all. The cells I can define later and the looping I can do as well.

Thank you very much.

Luis

fumei
01-12-2013, 05:50 PM
"I just need the code to open a excel file and put a cell value in a bookmark."

Again, there are LOTS of examples of this if you look, even here on this forum.

"For each report I have 10 variables, and each one has 3 values "

Not possible. Variables have one value. They can of course have many possible potential values, but when you get the return value of a variable it is one value.