LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Trefor
 
Posts: n/a
Default

Dave, thankyou that fixed that problem, but the bigger issue I am still
having problems with. I have searched around here and found many people
looking for the same thing (using keywords: grab, copy, import, extract)

To explain what I am trying to do in more detail: (using Office 2003)

I would like to run a macro in Excel that:

1. Checks to see if there is an open Word document. (I dont want to specify
a name or have to open the file from within Excel)

2. Select and copy the data from word to excel. (The word documents (for
some reason beyond my control) have text boxes set in autoshapes to look like
tables, each cell within the table has a text box and the text box has
several lines of text in it (names and addresses for example))

3. I am guessing for simplicity it would be easier to just grab everything,
then paste it into a "scratch" area in excel, and then I can pick and choose
what I want from the scratch area.

I am fairly happy with macro's/VBA in excel, what I am not familiar with is
VBA in Word or switching between the two.

Any help very much appreciated.

--
Trefor


"Dave Peterson" wrote:

Click on Tools|References
Then scroll down looking for:
Microsoft Word xx.0 Object library

(xx.0 will change with the version of word/office you have.)

Trefor wrote:

Thankyou for the reply, but I must be missing something here. I am still
learning about macros/VBA in Excel and no nothing about macros/VBA in Word.

I tried to run the code and got an error:

Dim wdApp As Word.Application User-defined type not defined.

--
Trefor

"HiArt" wrote:


hi Trefor,

Yes, that's one of the advantages of the MS Office Family!

Look in Excel VBA help "Controlling One Microsoft Office Application
from Another".

A quick search in Google found this:
http://www.mindspring.com/~tflynn/ex...html#Open_Word.

You'd replace the "With mywdRange" with code appropraite to your
problem. It's fairly straight-forward if you know Word VBA. Once word
is open use:

Selection.Tables(1).Select ' goes to a specified table occurence
Selection.SelectRow
Selection.Copy

The switch back to Excel and Paste.

HTH

Art


--
HiArt
------------------------------------------------------------------------
HiArt's Profile: http://www.excelforum.com/member.php...o&userid=19953
View this thread: http://www.excelforum.com/showthread...hreadid=472033



--

Dave Peterson



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I import formmail data to a custom excel template? cxlough41 Excel Worksheet Functions 1 July 1st 05 12:59 AM
Excel data not transfering to Word. Colums are expanded. carolsue1313 New Users to Excel 2 June 24th 05 08:16 PM
Macro - Open Word with Excel macro Bill Excel Discussion (Misc queries) 3 May 23rd 05 11:21 PM
exporting excel worksheet to word morrowkd Links and Linking in Excel 1 May 11th 05 11:23 PM
Can Excel Export Data to Word Format? Reddiance Excel Discussion (Misc queries) 2 April 18th 05 06:03 PM


All times are GMT +1. The time now is 06:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"