简体   繁体   中英

Excel VBA command Workbook_open not working

I am not able to get workbook_open to display a message when I open a workbook.

Based on past feedback I have placed the code in the "This workbook" tab. Works in one file and doesn't in another. What should I look for?

Private Sub Workbook_Open()
   If Weekday(Now) = vbThursday Then
    Msg = "Today is Thursday. MAke sure that you "
    Msg = Msg & "submit the TPS report."
    MsgBox Msg, vbInformation
   End If
 End Sub

The message is not displayed

I tested your code and it worked. This means it's not an issue with how it is written but other factors.

Double check your spreadsheet is saved as a file type that allows macros, such as .xlsm or .xlsb .

When you open the file, check it there's a yellow ribbon saying "Enable Content". Trust the file, then each time it's opened after that it should run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM