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 / July 2005

Tip: Looking for answers? Try searching our database.

catching .style failure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gerard Duquette - 21 Jul 2005 21:01 GMT
Hi all,

In VBA, when using the selection.characters(1).style, if there is no style
defined at that location a run time error is generated and the macro ends. Is
there a way to catch this error and prevent the macro from stopping?
I need to do this because I dont know if the location has a style set. There
is no mention in the docs of a returned value from that function. I cant
believe that a function is built under the assumption that it cannot fail.

Can anybody help?

Thank you.

Signature

Gerard Duquette
X.Systems Inc

Word Heretic - 22 Jul 2005 01:42 GMT
G'day Gerard Duquette <GerardDuquette@discussions.microsoft.com>,

On Error   is the general purpose error trap.

Also pre-check the range is valid, ie the .end is > than the .start.
Every character should have a style, even if it is just Normal or
Default paragraph font.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice

Gerard Duquette reckoned:

>Hi all,
>
[quoted text clipped - 8 lines]
>
>Thank you.
 
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.