Solved: Embedding an edited excel sheet in word.

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

ranon

Thread Starter
Joined
Jan 2, 2005
Messages
6
I need to embed an excel sheet into word quite regularly. It looks like the sample document given. Generally only the price changes but the formulas remain the same.

Is there some word macro that can accomplish this?
 

Attachments

Joined
Jul 1, 2005
Messages
8,546
Have you tried Paste Link?

Copy your range in Excel. Switch to Word, then Edit > Paste Special. For "As", highlight Excel Worksheet Object, and select Paste Link. You should see info that says "changes to the source will be reflected in your document", so ... "auto-updating".

Welcome to the board.
 

ranon

Thread Starter
Joined
Jan 2, 2005
Messages
6
Yes, that would work.

A macro to copy - paste would make the job a lot easier. I could use some help on that.
 
Joined
Jul 1, 2005
Messages
8,546
ranon said:
Yes, that would work.

A macro to copy - paste would make the job a lot easier. I could use some help on that.
Since the table in your doc is dynamically linked to the source (table in Excel), I don't see how.

Is there some other info you've not shared? (such as data in Excel may vary in size or has a variable location)
 

ranon

Thread Starter
Joined
Jan 2, 2005
Messages
6
Since the table in your doc is dynamically linked to the source (table in Excel), I don't see how.
Its not dynamically linked. An embedded copy paste (static) is what I want. After pasting each word document will change the prices and other minor formatting as required.
 

ranon

Thread Starter
Joined
Jan 2, 2005
Messages
6
The data in Excel has a fixed location and a range to copy from.

(This is basically a sheet that I create myself for convenience)
 
Joined
Jul 1, 2005
Messages
8,546
Yeah, I do understand what you're saying (now), but I'm struggling for a best method.

What I like the look of is ... a "template" doc (not an actual template) with the table in, and a bookmark defined for the table.

Then you can use Insert > File, and specify the bookmark (say "Table") as the range to insert. That way, the source doc needn't be opened at any time.

That translates as a fairly simple Word macro:

Sub test()
Selection.InsertFile FileName:="test.doc", Range:="table", _
ConfirmConversions:=False, Link:=False, Attachment:=False
End Sub


although, you might need to define the path to test.doc if its directory doesn't match your current doc.

Let me test it some more.
 
Joined
Jul 1, 2005
Messages
8,546
This seems to work:

Sub test()
ChangeFileOpenDirectory "C:\Documents and Settings\Andy\My Documents\"
Selection.InsertFile FileName:="test.doc", Range:="table", _
ConfirmConversions:=False, Link:=False, Attachment:=False
End Sub


You'd need to insert it in an added module under Project - Normal in the Word VBE*. Do you know how to do that?

*after which you could probably assign it to a toolbar button.
 

ranon

Thread Starter
Joined
Jan 2, 2005
Messages
6
I tested it out. It works.

I added it as a macro in the normal template. I will give it a shortcut key, maybe add it to the ribbon.

Thanks a million. This will save me a lot of work. I am already going to tweak it a little, e.g. have 2-3 macros for different flavors of tables. Thanks again.
 
Joined
Jul 1, 2005
Messages
8,546
ranon said:
I tested it out. It works.

I added it as a macro in the normal template. I will give it a shortcut key, maybe add it to the ribbon.

Thanks a million. This will save me a lot of work. I am already going to tweak it a little, e.g. have 2-3 macros for different flavors of tables. Thanks again.
(y)

I'm sure you realise that you could store the different tables in a single "template" doc, so long as each one has its own bookmark for the macros to identify.

Use Thread Tools at the top of the page to mark this Solved if you wish. :)
 

ranon

Thread Starter
Joined
Jan 2, 2005
Messages
6
(y)

I'm sure you realise that you could store the different tables in a single "template" doc, so long as each one has its own bookmark for the macros to identify.
That was the idea. It's a nice, clean solution. (y) (y)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top