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 / February 2007

Tip: Looking for answers? Try searching our database.

Method KeepWithNext has failed error message when used with Excel

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alex St-Pierre - 27 Feb 2007 01:16 GMT
Hello!
I use automation to program a word report from excel vba. When I write the
following lines, I got the error msg Method _ParagraphFormat has failed. It
works 99% of the time. I don't know why it gives this error message sometimes.
Set oRange = docWord.Paragraphs(i).Range
oRange.ParagraphFormat.KeepWithNext = True 'error        
oRange.ParagraphFormat.KeepTogether = True 'error too
Sometimes, only one or both gives error.. It often happens inside a table
when it takes 2 pages. I don't know what I can do in Excel to avoid that.
oRange.ParagraphFormat.KeepTogether = 99999999 or 0 before giving an error.
Thanks a lot!
Alex
Signature

Alex St-Pierre

Jezebel - 27 Feb 2007 01:29 GMT
Word uses 99999999 as a pseudo constant to mean 'mixed' or 'undefined'. It's
the value you get if what you're looking at includes more than one value
(such as the font size for a range that includes text of different sizes).

Why not trap the error, and treat the occurrences as a special case? Apart
from that it's hard to diagnose unless you can see some pattern in the
paragraphs that throw the error.

> Hello!
> I use automation to program a word report from excel vba. When I write the
[quoted text clipped - 11 lines]
> Thanks a lot!
> Alex
 
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.