Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2007

Tip: Looking for answers? Try searching our database.

Setting table properties in code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tedmi - 28 Mar 2007 01:52 GMT
A table pasted from the clipboard into an empty doc needs to have its
properties set (it was copied to the clipboard by Excel). However, statements
like this are failing:
Selection.Tables(1).Rows.AllowBreakAcrossPages = False
The error message is 4608, Value out of Range.
?Selection.Tables.Count shows 1 in the immediate window,
and ?Selection.Tables(1).Rows.AllowBreakAcrossPages displays -1

If I create a table by hand, and run the code, it works - but not on the
table imported from Excel.

Here's how I built it. Opened an existing .dot file, created a table by
hand, recorded a macro that sets the properties, deleted the table.
But when I open a doc from this dot, and paste the Excel-created table, no
joy.

Any clues? Thanks.
Signature

TedMi

tedmi - 28 Mar 2007 13:22 GMT
Found the solution: The pasted table exceeded Word's width limit of 22
inches. No warning, and table properties could be set via the UI, but some
operations in code would fail. I limited the width by letting the text wrap
in the rightmost column in Excel.
Signature

TedMi

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.