Hi all,
I'm attempting some code that will take the height and width values from an
active Word table cell, and then use them to adjust the page margins of an
active chart sheet, with the end result being both the Word cell and Excel
chart sheet share identical dimensions. Unfortunately, the code seems a
little beyond me. Is it possible?
Any help (or code) much appreciated ...
Best wishes to all,
Rich
Chuck - 14 Jun 2005 11:47 GMT
Unfortunately its so difficult as to be for all intents and purposes
impossible.
Excel column widths are measured in character widths (from Excel VBA Help re
ColumnWidth property: "One unit of column width is equal to the width of one
character in the Normal style. For proportional fonts, the width of the
character 0 (zero) is used.) Word columns of course do not use that kind of
measurement.
Using the Excel Width property you can return but not set an Excel column
width in points (however it appears to be a Long data type which means no
decimal points so you could have an Excel column Width of 48 points but not
48.5 points as you could in Word).
However you can set Excel row heights in points as you would in Word:
Dim objExcel As Object
Set objExcel = GetObject(, "Excel.application")
objExcel.Worksheets("Sheet1").Range("A1").RowHeight = _
ActiveDocument.Tables(1).Cell(1, 1).Height
Yet another set of mystifying architectural decisions by the braniacs at
Microsoft.
Why are you trying to reproduce a Word table "identically" in Excel?
HTH
> Hi all,
>
[quoted text clipped - 9 lines]
>
> Rich
Rich Moore - 14 Jun 2005 13:04 GMT
Hi Chuck - thanks for the reply - I really appreciate it.
Here's the background ...
I'm doing a lot of financial reports in Word, which contain a lot of Excel
charts that are pasted into Word table cells as Pictures (rather than being
embedded).
I'm currently spending a lot of time manually resizing the Excel
Chart Sheet (for each Chart), so that when I copy the Chart as a Picture,
and paste it into the Word table cell, it is reproduced exactly at 100%,
font sizes etc. staying consistent, and fits the Word Table Cell precisely.
What I'm struggling to do (I expressed myself badly in the original post -
sorry) is to create some code that does the following:
1. From Excel, reads the height and width of my active Word table cell
2. Imports these two values from Word to my active Excel Chart Sheet, and
...
3. Then uses these two values to adjust the Page Margins (File, Page Setup,
etc..) of the Excel Chart Sheet
4. The end result being that the dimensions of the Chart Sheet are identical
to the dimensions of the Word Table Cell
I can then copy the chart as a picture, then flip to Word and paste it into
the cell, and it fits like a dream! Hope that makes sense. I'm determined
to crack it! Any help genuinely appreciated as always
Thanks again
/rich