Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code to transfer a Range to a Word doc

For years I have struggled to find some elegant VBA code to transfer a
Excel Range to a bookmarked location in a Word document. It sounds s
simple and an obvious piece of functionality but I have found that OL
presents problems when I have VBA code that formats the embede
spreadsheet or that the spreadsheet is part of larger Excel Applicatio
suite (as is my case), or where the source spreadsheet is needed i
many Word documents.

Rather than live data/tables from Excel, I'd prefer to simply copy th
range of the sheet and paste it to Word.

Some solutions I have tried include;
1) DDE pokes (but didn't really understand it fully, or the code
borrowed opened a new document every time it ran)

2) Copy and paste to the clipboard, which was possible from Excel usin
VBA but once I got to Activate Word to find the "Paste location" in th
Word document, I was stumped because I didn't understand the righ
commands in the Word VBA library or the Library wasn't available. (
can fix this for me but as I want to share the code I need a way t
make sure the Word Object Library is available.)

3) Paste Linking the range from Excel to Word (which is unwieldy) an
then breaking the links in Word before saving the document so as t
save system overhead and ensure that saved Word documents don't updat
the pasted Range.

In short, this is how I imagine the code should go.

From Excel
Select Workbook.Worksheet and This Range
Copy
Check if Word is Active
If not, Open with Document New from Template "My Template - wit
Bookmarks"
Else Activate Word - MyDocument with Bookmarks
Find Book_Mark_1
Paste Range from ClipBoard
Activate Excel
Select This workbook
Cancel Copy
(Plus any error trapping routines)

I'd be greatful for any guidance on this issue. :confused

--
Message posted from http://www.ExcelForum.com

Reply
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 transfer data from one sheet to another with VB code Albert Excel Discussion (Misc queries) 2 June 15th 07 01:40 PM
Transfer Macro code to another computer Corey Excel Discussion (Misc queries) 0 May 24th 06 11:09 PM
How can I transfer something from a cd to a word document? gramsba Excel Discussion (Misc queries) 1 February 19th 06 04:01 AM
TRANSFER AUTOTEXT FROM WORD TO EXCEL? autofill Excel Worksheet Functions 2 February 14th 06 08:16 AM
is it possible to transfer a word doc to excel? Toffee New Users to Excel 2 June 10th 05 10:01 PM


All times are GMT +1. The time now is 11:56 PM.

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

About Us

"It's about Microsoft Excel"