VBA Question - Word Table Cells

R

Rich Moore

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
 
C

Chuck

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top