PDA

View Full Version : Solved: Macro to import data from Excel to Word, which application should I write it in?



RECrerar
08-11-2009, 08:00 AM
Hi,

I've been tasked with writing a macro to automatically import data into a word document.

The main activities are to extract data from a table in an Excel spreadsheet and create a new table in word for each row. Before each table, two plots saved external to Excel need to be imported, these are identified by looking up their names from the Excel spreadsheet. Attached is a word doc with a commented version of what I am trying to achieve.

My question is simply, would it be best to write the code is word and connect to Excel or visa versa. I think the users would probably prefer to run everything through Wrod, but they are a bright bunch so I'm sure they could cope.

Any suggestions would be appreciated.

Thanks

Bob Phillips
08-11-2009, 09:18 AM
Personally, I can't see it would make much difference.

Myself, I find the Word object model odd, so I would probably do it in Word, where the object model is more readily to hand.

RECrerar
08-12-2009, 05:50 AM
Hey,

Thanks for the advice. If there is not much difference I think I will go with Word as, as mentioned, I think that will be more intuative for the people who will be using it.

Word is not my VBA forte so I predict a fair few posts in the Word forum.

Thanks again. Robyn