an example of properties throwing an exception

D

David Thielen

I am called on the event
Microsoft.Office.Interop.PowerPoint.Application.WindowSelectionChange
and have the following:

ActiveWindow.Selection gives me a valid selection object.
Selection.Type = ppSelectionText
Selection.TextRange throws a:
"Selection (unknown member) : Invalid request. Nothing appropriate is
currently selected."

All properties:
+ [System.__ComObject] {System.__ComObject}
System.__ComObject
+ Application {System.__ComObject}
Microsoft.Office.Interop.PowerPoint.Application {System.__ComObject}
+ ChildShapeRange 'sel.ChildShapeRange' threw an
exception of type 'System.Runtime.InteropServices.COMException'
Microsoft.Office.Interop.PowerPoint.ShapeRange
{System.Runtime.InteropServices.COMException}
HasChildShapeRange false bool
+ Parent {System.__ComObject} object
{System.__ComObject}
+ ShapeRange 'sel.ShapeRange' threw an exception of
type 'System.Runtime.InteropServices.COMException'
Microsoft.Office.Interop.PowerPoint.ShapeRange
{System.Runtime.InteropServices.COMException}
+ SlideRange {System.__ComObject}
Microsoft.Office.Interop.PowerPoint.SlideRange {System.__ComObject}
+ TextRange 'sel.TextRange' threw an exception of
type 'System.Runtime.InteropServices.COMException'
Microsoft.Office.Interop.PowerPoint.TextRange
{System.Runtime.InteropServices.COMException}
Type ppSelectionText
Microsoft.Office.Interop.PowerPoint.PpSelectionType


Any idea what's going on here?

thanks - dave

david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
J

\Ji Zhou [MSFT]\

Hello Dave,

I have a quick test on the WindowSelectionChange event. It does not throw
an exception when accessing the TextRange in my side. Only the
ChildShapeRange throws an exception because the selected text does not have
any child shape. All other properties return correctly as the following
shows,

- Sel {System.__ComObject} Microsoft.Office.Interop.PowerPoint.Selection
{System.__ComObject}
+ [System.__ComObject] {System.__ComObject} System.__ComObject
+ Application {System.__ComObject}
Microsoft.Office.Interop.PowerPoint.Application {System.__ComObject}
+ ChildShapeRange 'Sel.ChildShapeRange' threw an exception of type
'System.Runtime.InteropServices.COMException'
Microsoft.Office.Interop.PowerPoint.ShapeRange
{System.Runtime.InteropServices.COMException}
HasChildShapeRange false bool
+ Parent {System.__ComObject} object {System.__ComObject}
+ ShapeRange {System.__ComObject}
Microsoft.Office.Interop.PowerPoint.ShapeRange {System.__ComObject}
+ SlideRange {System.__ComObject}
Microsoft.Office.Interop.PowerPoint.SlideRange {System.__ComObject}
+ TextRange {System.__ComObject}
Microsoft.Office.Interop.PowerPoint.TextRange {System.__ComObject}
Type ppSelectionText Microsoft.Office.Interop.PowerPoint.PpSelectionType

What is type of the shape in which you select the text? Did you test on
different kinds of shapes and did the exception occur despite of the host
shape? My PowerPoint version is PowerPoint 2007 (12.0.6307.5000) SP1 MSO
(12.0.6320.5000). What is your version of PowerPoint? I collect this
information for trying to reproduce the issue in my side. Once reproduced,
I can try my best to do some more investigation to see what has caused the
issue. Thanks for your understanding on this.

Have a good day!

Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

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://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

David Thielen

Hi;

I am running 12.0.6307.500 SP1 MSO - so same version. This occurs when
I do a drag drop (when it is putting it in the upper left) and PPT
then updates the ribbon, which calls my code to see which ribbon items
are enabled - I then look at the selected shape - and get this
problem.

thanks - dave


Hello Dave,

I have a quick test on the WindowSelectionChange event. It does not throw
an exception when accessing the TextRange in my side. Only the
ChildShapeRange throws an exception because the selected text does not have
any child shape. All other properties return correctly as the following
shows,

- Sel {System.__ComObject} Microsoft.Office.Interop.PowerPoint.Selection
{System.__ComObject}
+ [System.__ComObject] {System.__ComObject} System.__ComObject
+ Application {System.__ComObject}
Microsoft.Office.Interop.PowerPoint.Application {System.__ComObject}
+ ChildShapeRange 'Sel.ChildShapeRange' threw an exception of type
'System.Runtime.InteropServices.COMException'
Microsoft.Office.Interop.PowerPoint.ShapeRange
{System.Runtime.InteropServices.COMException}
HasChildShapeRange false bool
+ Parent {System.__ComObject} object {System.__ComObject}
+ ShapeRange {System.__ComObject}
Microsoft.Office.Interop.PowerPoint.ShapeRange {System.__ComObject}
+ SlideRange {System.__ComObject}
Microsoft.Office.Interop.PowerPoint.SlideRange {System.__ComObject}
+ TextRange {System.__ComObject}
Microsoft.Office.Interop.PowerPoint.TextRange {System.__ComObject}
Type ppSelectionText Microsoft.Office.Interop.PowerPoint.PpSelectionType

What is type of the shape in which you select the text? Did you test on
different kinds of shapes and did the exception occur despite of the host
shape? My PowerPoint version is PowerPoint 2007 (12.0.6307.5000) SP1 MSO
(12.0.6320.5000). What is your version of PowerPoint? I collect this
information for trying to reproduce the issue in my side. Once reproduced,
I can try my best to do some more investigation to see what has caused the
issue. Thanks for your understanding on this.

Have a good day!

Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

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://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
J

\Ji Zhou [MSFT]\

Hello Dave,

If I drop a table onto the slide, the TextRange property does throw an
exception. But I think that makes sense since there is no text currently
selected in the slide. And in this case, the selected content is a shape
and I have the selection type as ppSelectionShapes. If I want to access the
cell's text, I can convert the Sel variable to table type and iterate its
cells.

Although it throws an exception when accessing the TextRange property in
the above case, I think it may not be the exactly same scenario in your
side because your selection type is ppSelectionText indeed. This is a very
strange thing that I have not encountered. To do some future investigation,
I need to reproduce the issue in my side. Therefore, would you mind sharing
a reproducible project or some codes you are using? You can contact me
directly via (e-mail address removed). Thank you!

Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

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://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Top