How to call VBA/c# code from office js without using API

Mahi Deo 0 Reputation points
2024-09-03T19:53:32.8433333+00:00

There are few limitation in offcie js Excel such as reading or adding notes into the cell.

I want to use VBA in these cases. How can I trigger the event or run the VBA code from office js Excel

If there is any way I can invoke ribbon commands(defined in xlam file) from office js , that would also be appreciated

Microsoft 365 and Office Development Office JavaScript API
Microsoft 365 and Office Development Other
Microsoft 365 and Office Excel For business Windows
Developer technologies VB
Developer technologies C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jan Karel Pieterse 1 Reputation point MVP
    2024-09-05T12:03:19.6533333+00:00

    I can imagine a workaround that works as follows:

    • The office-js add-in adds a row to a table on a (hidden) worksheet with all details for the Note: Sheet, Cell address, Comment text
    • The VBA add-in has an application-level event handler that responds to changes made to that worksheet.
    • If a change is detected, the VBA add-in reads the table and inserts the notes appropriately, then empties the table.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.