PC Review


Reply
Thread Tools Rate Thread

Copying Excel table to Word, with Formatting

 
 
Squeff
Guest
Posts: n/a
 
      30th Aug 2007
I have an application that builds a nice looking table in Excel. The
end-user wants this to be as Word table, instead.

The spreadsheet has 10 columns (all equal width), although the columns
are merged in some rows.

I have a VBA routine (in Excel) that copies the spreadsheet and pastes
it into Word.

It looks good, but is too wide to fit on the page and it resizes the
columns inappropriately, so I issue this command
appWD.Selection.Tables(1).AutoFitBehavior (wdAutoFitWindow)
to (at least) make it fit on the page. However, this resizes the
columns in a way different than I want them.

I'd like to be able to have my paste use the exact same relative
columns widths as the source.

I've tried
appWD.Selection.Tables(1).Columns.Width = 44.25
but this doesn't work because I have merged cells. I can't specify a
column index, because I then get a message that it can't refer to
specific column indexes because of the merged cells.

The end result has to be a normal Word table, so I can't make it a
graphic. I can't have Excel save as an RTF, because this strips a
good deal of my formatting.

Any ideas of how I can end up with an exact copy of my Excel
spreadsheet as a Word table? All formatting, save for the widths, is
perfect.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2V2aW4gQg==?=
Guest
Posts: n/a
 
      30th Aug 2007
Why not embed the Excel file as an object in Word? Would that work?
--
Kevin Backmann


"Squeff" wrote:

> I have an application that builds a nice looking table in Excel. The
> end-user wants this to be as Word table, instead.
>
> The spreadsheet has 10 columns (all equal width), although the columns
> are merged in some rows.
>
> I have a VBA routine (in Excel) that copies the spreadsheet and pastes
> it into Word.
>
> It looks good, but is too wide to fit on the page and it resizes the
> columns inappropriately, so I issue this command
> appWD.Selection.Tables(1).AutoFitBehavior (wdAutoFitWindow)
> to (at least) make it fit on the page. However, this resizes the
> columns in a way different than I want them.
>
> I'd like to be able to have my paste use the exact same relative
> columns widths as the source.
>
> I've tried
> appWD.Selection.Tables(1).Columns.Width = 44.25
> but this doesn't work because I have merged cells. I can't specify a
> column index, because I then get a message that it can't refer to
> specific column indexes because of the merged cells.
>
> The end result has to be a normal Word table, so I can't make it a
> graphic. I can't have Excel save as an RTF, because this strips a
> good deal of my formatting.
>
> Any ideas of how I can end up with an exact copy of my Excel
> spreadsheet as a Word table? All formatting, save for the widths, is
> perfect.
>
>

 
Reply With Quote
 
Squeff
Guest
Posts: n/a
 
      4th Sep 2007
On Aug 30, 2:20 pm, Kevin B <kbackm...@sbcglobal.net.spamBgone> wrote:
> Why not embed the Excel file as an object in Word? Would that work?
> --
> Kevin Backmann


Unfortunately not. The customer wants the resultant table to act like
a Word table, not an Excel table. This may seem a subtle thing, but
there are some key differences. For example, Word will nicely
autosize rows (even for merged cells), while Excel will not.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Keep Word formatting when copying text to Excel Beckyblanco Microsoft Excel Misc 1 17th Dec 2008 03:34 PM
Copying Autoshapes from Excel to Word: losing formatting Nick Hebb Microsoft Word Document Management 1 2nd Jun 2005 01:30 PM
Copying excel table into word? =?Utf-8?B?TmluamFraWQ=?= Microsoft Word Document Management 3 26th May 2005 05:13 PM
Formatting problems when copying Excel spreadsheet to Word =?Utf-8?B?TWFyeUx5bm5l?= Microsoft Excel Misc 3 4th May 2004 02:07 AM
copying Word-Table to Excel peter Microsoft Excel Misc 2 30th Aug 2003 01:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:21 AM.