VB in Microsoft 365 Online

Tgpitch16

New Member
Joined
Jul 8, 2015
Messages
26
Office Version
  1. 365
Platform
  1. Windows
I added the following VB code when a user opens a particular file, it will automatically pop up with a message, then prompt the user to Save As a copy. The goal is to preserve the original contents of the file. All of the audience will be using the online version of Microsoft 365 Excel. Is there a way to accomplish this?

Private Sub Workbook_Open()
' Display a message box explaining to the user to Save As a new document
MsgBox "Before you begin, you will be prompted to Save As a new file. Name this file the date of your store visit. ", vbInformation, "Save As Prompt"

' Prompt the user with the Save As dialog box
Application.Dialogs(xlDialogSaveAs).Show
End Sub
 
Excel Online doesn't support VBA. You can write macros with Office Scripts, but there's no event handling feature, so any scripts would have to be run manually. So you would probably have to look into Power Automate for this (which I don't know too much about).

Differences between Office Scripts and VBA macros - Office Scripts

Office Scripts don't support Excel-level events. Scripts are only run when a user manually starts them or when a Power Automate flow calls the script.
 
Upvote 0

Forum statistics

Threads
1,226,837
Messages
6,193,254
Members
453,784
Latest member
Chandni

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top