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 2005

Tip: Looking for answers? Try searching our database.

ExtendMode being turned off by WindowSelectionChange event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tim - 08 Feb 2005 17:13 GMT
ExtendMode being turned off by WindowSelectionChange event

I have a class that contains a WindowSelectionChange event.
Whenever the event is triggered, the ExtendMode is being turned
off before the event routine is completed. This event is also affecting
the functionality of the F2 (MoveText) and the Format Painter functionality.

I can Email the test template to anyone that is interested in looking
at it (tbs2@pge.com) or it can be setup as follows:

Steps to setup test template

1. Create a Class module call ProcClass with the following contents:

Option Explicit
Public WithEvents MyWord As Word.Application

Private Sub MyWord_WindowSelectionChange(ByVal Sel As Selection)
 iClassTrigger = iClassTrigger + 1
 StatusBar = " Class triggered: " & CStr(iClassTrigger) & ", ExtendMode: "
& _
    Selection.ExtendMode
End Sub

2. Create a code module with the following contents
Option Explicit

Public wdApp As New ProcClass
Public iClassTrigger As Integer

Sub AutoOpen()
Set wdApp.MyWord = Word.Application             'Initializes Class
End Sub

'These last 2 routines aren't required
Sub DestroyClass()    'Destroys Class
Set wdApp.MyWord = Nothing
End Sub

Sub CheckClass()    'Re-initializes Class if not found
If wdApp.MyWord Is Nothing Then
 Set wdApp.MyWord = Word.Application
End If
End Sub

3. Save the template and then re-open it.
The statusbar will display incrementally the number of times the event was
triggered and the ExtendMode status.
If ExtendMode is ON, the ExtendMode will be turned off when the ChangeEvent
is completed.

Thanks in advance for your time looking at this.
Signature

Tim Shaffer

Word Heretic - 09 Feb 2005 00:28 GMT
G'day Tim <Tim@discussions.microsoft.com>,

This as per design requirements. ExtendMode ends when there is another
selection. Why not just re-enter extend mode at the end of your guff,
using the activeend of the required range as your base.

Steve Hudson - Word Heretic

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

Tim reckoned:

>ExtendMode being turned off by WindowSelectionChange event
>
[quoted text clipped - 48 lines]
>
>Thanks in advance for your time looking at this.
Tim - 09 Feb 2005 15:21 GMT
Steve,

Thank you for your reply.

But I am confused. Here are my confusion points.

1. "ExtendMode ends when there is another selection."
Isn't the concept of ExtendMode that is stays ON as additional
objects are selected?

2. "Why not just re-enter extend mode at the end of your guff"
The ExtendMode is ON (last line of event) as indicated by the
StatusBar display. I tried adding another line
"Selection.ExtendMode = True", but still ended with the same
result.

Thanks for your help.

Tim

> G'day Tim <Tim@discussions.microsoft.com>,
>
[quoted text clipped - 61 lines]
> >
> >Thanks in advance for your time looking at this.
Word Heretic - 13 Feb 2005 05:54 GMT
G'day Tim <Tim@discussions.microsoft.com>,

1. No, it is merely the stuff between a starting point and ending
point, both made by selections. It is not a 'spike' you can gather
random selections on.

2. Select the range created by 1. Maybe ScrollIntoView to view end.
Turn extend mode on.

Steve Hudson - Word Heretic

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

Tim reckoned:

>Steve,
>
[quoted text clipped - 81 lines]
>> >
>> >Thanks in advance for your time looking at this.
 
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.