PDA

View Full Version : Word and Excel Communication



dimmutal
04-04-2006, 01:02 AM
Hi there. I want a suggestion for a macro in Word, that will read the contents of a column in Excel and paste them in Word. I don't care how the data will be pasted. I just want the way to communicate with Excel and read the contents of some cells. Thanks

fumei
04-04-2006, 11:01 AM
If you executing from Word:

1. make an instance of Excel
2. open the Excel file
3. take the value of the cells you want and put it into a variable.
4. bring the variable back to Word and use it.

Of course making sure you close and properly remove the instance of Excel when you are done.

There are LOTS of examples of the basics of this on this site, and other sites, and in Help.

Please look things up, give it shot, and when you have some code you need help with, post it. It is not the intention of this site to simply hand off code solutions.

Go into Excel and record some macros on reading cell values. Look at the code. Read some FAQ.

Again if you have a SPECIFIC question we are more than happy to assist.

Say..."I tried using CreateObject("Excel.Application") to make the instance of Excel but it does not seem to be working right.".....that is a hint by the way.

Then sure, we will look at what you are doing and most likely can immediately tell you what will fix it.

I am NOT trying to be rude, or unhelpful. However:
I just want the way to communicate with Excel and read the contents of some cells.sounds like you are placing an order in a restaurant. There IS a way - obviously. It CAN be found with some looking up on your part. We are more than willing to help. And in fact, at the top of this post are exactly the steps you need to take.