Excel sheet in Word problem

P

Peter de Vroomen

Hi,

I have an Excel sheet that I want to include in a Word document. I do an
Insert Object with Create From File. But Word does not show all the columns
of my data, and I can't seem to get them shown by hand.

My purpose is to automate this from Visual Basic. In VB.NET I read the
UsedRange property, and the Columns and Rows members gave me the right
number of columns and rows (resp. 10 and 18). Still, Word only shows 8
columns instead of 10. It does show all the rows.

How can I get Word to show all the used columns?

I use Word 2000 SR-1, Excel 2000 SR-1 and VB.NET.

Regards,

PeterV
 
K

Ken Laws [MS]

Hi Peter,

Since you are only seeing eight of the ten columns from the Excel file when
the file is inserted, I assume that the remaining two columns are spilling
off the right margin of the document.

If this is the case then it appears that we are encountering an issue with
the size of the ten columns of data in the Excel file, in which case we
have a few options.

1. If possible adjust the margin settings of the Word document to allow
more width and/or change the orientation of the page to landscape.

2. Resize the columns within the Excel file and if possible use a smaller
font so that the columns can be resized to a scale that would allow all of
the columns to be viewed when inserted into Microsoft Word.

If modifying the Excel file is not an option or if it can't be modified to
a point where it will fit, the size of the inserted object can be modified
either manually or through code to allow all of the columns to be
displayed.

To manually adjust the size of the OLE object, once the file has been
inserted, right mouse click on the object and choose "Format Object".
Select the "Size" tab and then adjust the "Scale Height" and "Scale Width"
settings as necessary until all of the columns are displayed on the page.

Sample Visual Basic .NET code to manipulate the Scale Height and Width
would be as follows:

oDoc.InlineShapes.Item(1).LockAspectRatio = Office.MsoTriState.msoTrue
oDoc.InlineShapes.Item(1).ScaleWidth = 75
oDoc.InlineShapes.Item(1).ScaleHeight = 75


In the above code, oDoc is a variable referencing the document containing
the inserted object.

I hope this helps!

If you have any questions please let me know via the posting.

Regards,

Ken Laws
Microsoft Support


This posting is provided "AS IS" with no warranties, and confers no rights.
 

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