Search code examples
typescriptmessageboxexcel-online

Excel Online Script for Message Boxes


I am working on converting all of my VBA scripts over to Excel Online automation. Has anyone figured out how to convert MsgBox from VBA to Excel Online automation?

ex: MsgBox "Some Text"

I'm setting my code attached to buttons for users to select. I'm trying to make my code as user friendly as possible but currently the only way someone will see a generated message is if someone selects "View Logs" to see messages from a console.log("Some Text").

Just trying to make sure that messages are read so I don't get bombarded with questions as to why it didn't run or why it didn't do what it was supposed to do. When it did run correctly but they need to resolve the message and re-run. Messages might be something as simple as "Date missing from input box" or "Data has not been updated. Please update and run again".

Thank you in advance!


Solution

  • This took a bunch of digging but I eventually found it. To get a message to display when someone runs an automation script using Excel Online use "throw" then your text. This will even send the message as high as MS Flow based on what I have read.

    I don't know where I found it on this site (https://learn.microsoft.com/en-us/office/dev/scripts/?view=office-scripts), but there is a PDF that does a much better explanation of all the different Excel Online automation functions. If you find it your life will be so much easer.