Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing Word Data into Excel, Manipulating and then back into Word 1

Status
Not open for further replies.

danharman

Technical User
Apr 24, 2001
22
AU
As mentioned above, I am attempting to automate the process of copying a particular portion of data from a MS Word document, paste it into MS Excel, manipulate this data, and then create a new MS Word document and paste back into word.

So far I have managed to create an object in MS Excel (via VB in Word) and make this visible - I am now having difficulty manipulating this data (ie. getting control of MS Excel and using VBA code to automate the manipulation).

Any help / suggestions would be appreciated - please bear with me as this is my first attempt working across applications!!

Daniel.
 
Hi,
You need to add a reference to Excel 9.0 Object Library (or whichever one is appropriate) in the VB editor. Menu Item - Tools/References

Hope this helps :) Skip,
metzgsk@voughtaircraft.com
 
Thanks Skip, for your suggestion. I have enabled the Excel 9.0 Object Library via Tools/References and hence are able to open a new worksheet in MS Excel.

What I am still having difficulty with though is actually operating MS Excel from VB - ie. what is the code to get control of MS Excel? I have tried various pieces of code that I use in VBA to move around MS Excel etc., but have had no luck. Any suggestions?

Cheers,

danharman
 
You need to define workbook and worksheet Objects and then set each object to to the instance you want to use. Then you use the objects to navigate through Excel from Word. Skip,
metzgsk@voughtaircraft.com
 
There are tons of samples in this forum. Do a string search for "Excel.Application" (minus the quotes). You should get hundreds of hits. -------------------------------------------------------------
Who is General Failure and why is he reading my hard disk?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top