PDA

View Full Version : Multiple Document_Open events possible?



ReltubP
12-08-2020, 09:50 PM
Is it possible to run more than one Document_Open event upon opening?

For example, a message box before a userform.

If so, what is the code?

gmayor
12-08-2020, 10:26 PM
You can run any number of commands from Document_Open. It is essentially just a macro that runs when a document is opened, saved in the ThisDocument module of the document. At its simplest -

Private Sub Document_Open()
MsgBox "This is a message"
UserformName.Show
End SubThe fact that you are opening a userform when the document is opened suggests that you are reusing a document. I would recommend that you use instead the Document_New event and save the document as a template from which new documents are created.

ReltubP
12-08-2020, 10:32 PM
Awesome.

Appreciate the quick reply.