How to detect Current Selection in a TextBox

Hi All,
I faced an issue regarding how to detect current selection in a Word Document TextBox. The Document looks like this,
I tried to use Application_WindowSelectionChange(Word.Selection Sel)
event to handle,
private void Application_WindowSelectionChange(Word.Selection Sel)
if (Sel.Range.ShapeRange.Count != 0)
return;
I found Sel.Range.ShapeRange.Count always 0. 
To reproduce this issue, I upload the test document in OneDrive, you can download from
here.
How to solve this issue?
Thanks a lot!
The future belongs to those who believe in the beauty of their dreams.

Hi friend,
Just use Sel.ShapeRange.Count instead.
On the other hand, to get selected text, we could use Sel.Text, to get whole selected
TextBox’s text, we could use Sel.ShapeRange.TextFrame.TextRange.Text.
Good job!
Regards
Starain
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • How to detect a selected row in ALV GRID

    Hi,
    Can anyone tell me how to detect and catch an event when a row is selected in an ALV GRID?
    I would like to catch such event when the end user presses Ctrl + Shif + Space bar.
    Thank you and best regards.
    Hassane.

    Hi,
    Use this wiki link, to have a checkbox with all the records in ALV Grid and to process those selected records at a user command, as per the requirement.
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/alv%252bgrid%252bdisplay%252bwith%252bcheckbox%252bto%252bprocess%252bselected%252brecords%252bat%252bruntime
    Hope this solves your problem.
    Thanks & Regards,
    Tarun Gambhir

  • How to know current selection rectangle

    Hello,
    I need to know (with SDK) the current selection rectangle.
    I use listener to create my action fonction but listener let to Set a selection but not Get.
    If someone can help me...
    Thanks

    There is a bounds to a selection of a document. BEWARE: This is the bounding rectangle of the selection. If you have a selection with holes in it then you may not be getting what you expect.

  • How to detect Current OS of client's PC ???

    Hi,
    Can anyone help me out to detect OS of Client PC ??? I am developing JSF application. I want to know that if anyone opens my site then the OS of that perticular PC should be detected. Can anyone help me out to solve this ????
    Thanks in advance....
    JSFGEEKS

    That's indeed also a good option which I completely overlooked. Heck, I ever wrote a browser stats tool which makes use of it ;)
    Though keep in mind that the client side has full control over what it sends along the request headers. Your application shouldn't rely that much on it. At highest just use it for statistics or so.

  • How to schedule the background job using current selection screen field val

    Hello Friends,
    How to schedule the background job using current selection screen field values.
    after completion of the job the spool should be sent as a mail to SAP Inbox.
    Is there any way to create the variant dynamically by reading the current selection screen values.
    Thanks,
    Ravi

    Hi,
    To get the variant details you can use teh following FM.
    'RS_VARIANT_CONTENTS'.
    Regards,
    Ankur Parab

  • Need help on how to specify the current select row in a View Object

    Hi,
    I have a ADF table on my page, when I was selecting the rows in this table, I want the set and get methods in the ViewRowImpl class to do some customized actions. I found out that each time regardless the row I select in the table, the viewrowimpl class will always return the data in the first row, I tried to use getCurrentRow in VO row impl. but still, gets the first row.
    Does anyone know how to get the selected row value in the View Object, or View Row Impl rather???
    Thanks!

    Hi,
    you can call a method exposed by the AM and pass teh rowKey of the selected row as an argument. When you configure the exposed AM method in the pageDef (creating a method binding) the argument is shown in a dialog from where you can use EL like #{bindings.iteratorName.currentRow.rowKey} to access the current selected row.
    Frank

  • How to get the specific name of the workset which is currently selected by the user in sap portal 7.0

    Dear Expert,
    I have one requirement like to read the selected workset name in portal by the current user.I have read two documents regarding how to retrieve the PCD contents (iViews, Pages, Worksets and Roles) and its properties like Created by, Changed by, Last changed by and others using PCD API.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/6112ecb7-0a01-0010-ef90-941c70c9e401?overridelayout=true
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/508baf88-9335-2d10-efa6-c6ad61e5fc4b?quicklink=index&overridelayout=true
    But I am not able to understand how to get the specific name of the workset which is currently selected by the user.Can you please help me.
    I am using portal 7.0.
    Thanks & Regards,
    Patralekha

    Hi Expert,
    I found that we can use Interface INavigationHelperService to read Portal Role selected by user at runtime from http://scn.sap.com/thread/52194
    But this class is available in SAP NetWeaver 7.30 Enterprise Portal .
    But in SAP NetWeaver 7.0 Enterprise Portal that interface is not available.
    INavigationService is available there.
    But didn't get any proper discussion on this interface for the same requirement.
    Can you please help me.
    Thanks & Regards,
    Patralekha

  • How to get the current selected value of a combo box or a option button?

    Hello All,
    I want to catch the current selected value of a combo box and also of a option button and want save it into different variables in my code. These option button and combo box are in a SAP business one form which I have created through VB dot.net coding.
    But I don't know how to do that, can any one send any example code for this.
    Regards,
    Sudeshna.

    Hi Sudesha,
    If you want to get the selected values you can do it as follows: The Combo Box value you can get from the combo box. If you want to get it on the change event, you must make sure that you check when BeforeAction = False. If you want to get an Option Button value you should check the value in the data source attached to the option button.
            Dim oForm As SAPbouiCOM.Form
            Dim oCombo As SAPbouiCOM.ComboBox
            Dim oData As SAPbouiCOM.UserDataSource
            oForm = oApplication.Forms.Item("MyForm")
            oCombo = oForm.Items.Item("myComboUID")
            oApplication.MessageBox(oCombo.Selected.Value)
            oData = oForm.DataSources.UserDataSources.Item("MyDataSourceName")
            oApplication.MessageBox(oData.ValueEx)
    Hope it helps,
    Adele

  • JTree: How to get the currently selected node

    How do I get the currently selected node in JTree?
    getLastSelectedPathComponent() this method always return the last selected node and not the current one.
    Thanks in advance
    Sachin

    Use
    TreePath selectedPath = tree.getSelectionPath()If your tree allows multiple selections, use
    TreePath [] selectedPaths = tree.getSelectionPaths() this will return an array of all selected tree paths.
    Once you get the tree path, call the treePath.getLastPathComponent(). this should tell you the currently selected node.
    Hope this helps
    Sai Pullabhotla

  • How do I display lyrics for current selection in Itunes for windows?

    How do I display lyrics for current selection in Itunes for windows? I have lyrics for many songs, am losing hearing and enjoy seeing the lyrics to remind me of my memory of the song...

    try this.. http://www.lyricsplugin.com/
    good luck.

  • How to detect sessions that are currently running parallel queries?

    Hi everyone,
    How to detect session that are currently running parallel queries?
    - The only way i can think of is querying pdml_Status from gv$session?
    - Is there a better way to do this?
    Follow up question:
    After detecting sessions that are running parallel queries how do i identify which sessions are slaves of which session?
    thanks!

    Start with V$PX_SESSION, however also take a look at V$PQ_* and V$PX_* tables.

  • How to read which item in a listbox is currently selected?

    Is it possible to read which item in a listbox is currently selected?
    I know how to tell what item in the list was double-clicked. I'd like to be able to click (once) on an item in the listbox and then use buttons on the front panel to affect the item(and list). For example, click on an item in the list and then click an "insert" button to add an item to the list before the selected one.
    I'd like to be able to do this with both regular and multicolumn listboxes.

    The value of the listbox is just a number for which row is currently selected. If you setup your listbox for 0 or more items or 1 or more items, then the value of the listbox is an array of I32 numbers showing which rows are selected. Use a property node to get the Item Names property (an array of the list items) and you can use the value(s) to index into the array. I have included a VI that I use to move items up and down in the list as well as delete items. Feed it the array of item names and the index for the line you want to move/delete. Then take the output and feed it back into a property node of item names.
    I hope this helps.
    Rob
    Attachments:
    Sequence_Element_Move.vi ‏37 KB

  • How to detect what keyboard is currently active on desktop?

    Hi there, I'm working on a virtual keyboard (window with buttons as keys) for my swing application. When I show keyobard window I would like to adjust the layout of my virtual keyboard to system keyboard that is currently active on desktop. But I don't know how to detect what keyboard is currently active. How to detect this? Thank you.

    I answered my own question - see
    http://forums.ni.com/t5/LabVIEW/Loading-and-Running-a-VI-on-a-cRIO-from-a-PC/td-p/796657
    On the Real-Time CompactRIO Properties > VI Server, you must check the box for TCP/IP protocol, which by default is unchecked.
    Also, when you make a Build Specification for a VI and set it to run on startup, you can still enter the VI name (not c:\ni-rt\startup\startup.rtexe) as the VI Path on the Open VI Reference.

  • Detect blue email reply at the current selected line

    Hi all,
    I want to detect whether a blue email reply line (see picture below) is at the current selected line and do some action. Is this possible to detect it? I think observing the ParagaphFormat of the current selection could be work.
    Jens

    Hi jfrederich,
    In addition to Eugene's reply, you can get the paragraph's Borders property, check the sub-properties of this property to determine if this selected paragraph has some blue border line:
    Outlook.Inspector inspector = Globals.ThisAddIn.Application.ActiveInspector();
    Outlook.MailItem currentOpenedMail = inspector.CurrentItem as Outlook.MailItem;
    Word.Document doc = currentOpenedMail.GetInspector.WordEditor as Word.Document;
    string s = doc.Application.Selection.Text;
    //doc.Application.Selection.ParagraphFormat.Reset();
    Word.Paragraph para = doc.Application.Selection.Paragraphs[1];
    Word.ParagraphFormat format = para.Format;
    Word.Borders borders = format.Borders;
    //check properties of borders variable to determine if this paragraph has some blue left border
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to get to know the current selected service?

    Can anyone tell me how to get the current selected service in MHP? I tried to find one but no result. Can javax.tv.media.MediaSelectControl.getCurrentSelection() gives me the answer?

    servicecontext.getService()

Maybe you are looking for