RE: Ok to call Application.get_Selection()?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello Dave,

We have a problem where we get a selection changed event when a user
double clicks on a mis-spelled word in Word 2007 and we then call
get_Selection(). We get an exception that says COMException (0x800A1759)
: Cannot create a Selection object when this dialog is active.

I am not sure if I understand the steps correctly. In order to reproduce
the issue on my side, I created an Office COM add-in (C#) in VS2005. In the
Addin's OnConnection event handler, I added the line:
((Word.ApplicationClass)application).WindowSelectionChange += new
Microsoft.Office.Interop.Word.ApplicationEvents4_WindowSelectionChangeEventH
andler(Connect_WindowSelectionChange);
to register Word 2007 Selection changed event. Then in the event handler, I
printed the selected text and the exception message if any:

void Connect_WindowSelectionChange(Microsoft.Office.Interop.Word.Selection
Sel)
{
try
{
if (!string.IsNullOrEmpty(applicationObject.Selection.Text))
Debug.Print(applicationObject.Selection.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

After the add-in was built and installed into Word 2007, I debugged it
inside VS2005. I double clicked some mis-spelled word in Word 2007, but
none exception message is popped up. I also tried double clicking texts in
some Field codes, and double clicking when some Office dialogs (e.g Find
dialog) is showing, unfortunately, I still cannot reproduce the error on my
side.

Would you help to check if my understanding of the steps is correct? Is
there any special Office dialog/menu showing when the error occurs on your
side? I have queried the error "Cannot create a Selection object when this
dialog is active" in our internal database, but did not find relevant issue
report. Therefore, I need more information about the problem. Would you
paste some codes or send me a small and reproducible sample so that I can
have a clearer picture of the issue?

Thanks
Jialiang Ge (jialge@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


.



Relevant Pages

  • RE: Ok to call Application.get_Selection()?
    ... Cannot create a Selection object when this dialog is active. ... none exception message is popped up. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.office.developer.com.add_ins)
  • RE: Oracle Client ORA-03113 error hangs my windows service
    ... To answer your question, Kevin, the service exception handling works ... service does use multiple threads, but they are all handled by the .NET ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: making code native in a C++/CLI program
    ... which makes the exception very strange. ... // but can't mix and match in-place copy construction ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.languages.vc)
  • RE: Strange LocalDataStoreSlot storage has been freed exception
    ... that this exception is generated in the finalizer of LocalDataStoreSlot. ... However using reflector I don't see such an exception being thrown from the ... Microsoft Online Community Support ... nature are best handled working with a dedicated Microsoft Support Engineer ...
    (microsoft.public.dotnet.framework.clr)
  • Re: How to intercept/catch exceptions in out-of-process RPC/COM calls
    ... I want the COM service to crash when something bad ... I do not want COM to intercept the exception and return ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.win32.programmer.ole)