locked
How to hook into worksheet selection event in javascript API RRS feed

  • Question

  • Hello,

    how do I detect that an Excel worksheet has been activated or selected in Javascript app and vice versa: How can I force the Excel worksheet named for example 'sheet2' to be selected by issuing a javascript command with office 2013 javascript api?

    Thursday, March 6, 2014 12:53 PM

Answers

  • Hi Pete,

    Excel apps for Office contains task pane app and content app, both of them are used to work with bindings or selections, it is different from Excel Object Model.

    Through JavaScript API for Office, there is no such method or property to achieve the goal.

    Here are some articles and samples for your reference:

    Understanding the JavaScript API for Office

    JavaScript API for Office (v1.0)

    Apps for Office sample pack

    In addition, if you need this feature, please access the site below to give us feedback: Customer Feedback for the Office Developer Platform.


    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.

    • Marked as answer by George Hua Thursday, March 13, 2014 10:17 AM
    Friday, March 7, 2014 9:41 AM
  • Hi Pete,

    >> Do you know if it is possible to achieve the same worksheet selection functionality in JavaScript by connecting to a VBA macro? Or is there any other way to do this? <<

    I understand it is very import to you. But I’m afraid we are not able to call a VBA macro in Office JavaScript API. As George mentioned above, we do not have worksheet selection change event in current API. Interaction with the Office client object models is partially supported in Apps for Office (see the table below, from blog Roadmap for Apps for Office, VSTO, and VBA)

    Comparison Dimensions

    Apps for Office

     

    VSTO

     

    VBA

    Automation and interaction with the host computer

     

    a

     

    a

    Interaction with the web

    a

     

    a

     

     

    User Interface customization

    partial *

     

    a

     

    partial

    Interaction with the Office client object models

    partial *

     

    a

     

    a

    Offline Availability

    partial **

     

    a

     

    a

    Support for latest tools and technologies

    a

     

    a

     

     

    Support for team development and source-control

    a

     

    a

     

     

    Ability to target multiple host applications with one   codebase

    a

     

     

     

    Ability to run code at application-level, across documents

     

    a

    partial

    Security and sandboxed environment

    a

     

     

     

    Ease of distribution, lifecycle, and telemetry

    a

     

     

     

    Built-in monetization opportunity

    a

     

     

     

    Cloud and Desktop Compatibility

    Office 2013+, and web-based O365   clients

     

    Office 2007+
      (desktop only)

     

    Office 2000+ (desktop only)

    Sorry for any inconvenience brought to you. If you have any feedbacks for Office development platform, please feel free to submit them to Customer Feedback for the Office Developer Platform.

    Regards,

    Jeffrey


    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.


    • Edited by Jeffrey_Chen_ Thursday, March 13, 2014 5:20 AM
    • Proposed as answer by George Hua Thursday, March 13, 2014 10:17 AM
    • Marked as answer by George Hua Monday, March 31, 2014 4:36 AM
    Thursday, March 13, 2014 3:37 AM

All replies

  • Hi Pete,

    Excel apps for Office contains task pane app and content app, both of them are used to work with bindings or selections, it is different from Excel Object Model.

    Through JavaScript API for Office, there is no such method or property to achieve the goal.

    Here are some articles and samples for your reference:

    Understanding the JavaScript API for Office

    JavaScript API for Office (v1.0)

    Apps for Office sample pack

    In addition, if you need this feature, please access the site below to give us feedback: Customer Feedback for the Office Developer Platform.


    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.

    • Marked as answer by George Hua Thursday, March 13, 2014 10:17 AM
    Friday, March 7, 2014 9:41 AM
  • Hi George,

    thanks for your answer. Do you know if it is possible to achieve the same worksheet selection functionality in javascript by connecting to a VBA macro? Or is there any other way to do this? It would be very important to get this done because otherwise I have to resort to a single sheet solution which at least in this case looks very messy and lacks usability.

    Monday, March 10, 2014 4:40 PM
  • Hi Pete,

    >> Do you know if it is possible to achieve the same worksheet selection functionality in JavaScript by connecting to a VBA macro? Or is there any other way to do this? <<

    I understand it is very import to you. But I’m afraid we are not able to call a VBA macro in Office JavaScript API. As George mentioned above, we do not have worksheet selection change event in current API. Interaction with the Office client object models is partially supported in Apps for Office (see the table below, from blog Roadmap for Apps for Office, VSTO, and VBA)

    Comparison Dimensions

    Apps for Office

     

    VSTO

     

    VBA

    Automation and interaction with the host computer

     

    a

     

    a

    Interaction with the web

    a

     

    a

     

     

    User Interface customization

    partial *

     

    a

     

    partial

    Interaction with the Office client object models

    partial *

     

    a

     

    a

    Offline Availability

    partial **

     

    a

     

    a

    Support for latest tools and technologies

    a

     

    a

     

     

    Support for team development and source-control

    a

     

    a

     

     

    Ability to target multiple host applications with one   codebase

    a

     

     

     

    Ability to run code at application-level, across documents

     

    a

    partial

    Security and sandboxed environment

    a

     

     

     

    Ease of distribution, lifecycle, and telemetry

    a

     

     

     

    Built-in monetization opportunity

    a

     

     

     

    Cloud and Desktop Compatibility

    Office 2013+, and web-based O365   clients

     

    Office 2007+
      (desktop only)

     

    Office 2000+ (desktop only)

    Sorry for any inconvenience brought to you. If you have any feedbacks for Office development platform, please feel free to submit them to Customer Feedback for the Office Developer Platform.

    Regards,

    Jeffrey


    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.


    • Edited by Jeffrey_Chen_ Thursday, March 13, 2014 5:20 AM
    • Proposed as answer by George Hua Thursday, March 13, 2014 10:17 AM
    • Marked as answer by George Hua Monday, March 31, 2014 4:36 AM
    Thursday, March 13, 2014 3:37 AM
  • OK, thanks for the information. I'll try to find some other way to get the job done. I will try to stick with Apps for Office anyway.
    Friday, March 14, 2014 5:27 AM