Pop up warning when opening Excel

Even

Board Regular
Joined
Jan 1, 2013
Messages
81
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have made an Excel file that me and my colleagues use, and I have created a pop up message asking if you are using the newest file. It is based on the current month. However, is it a way to create a warning pop up message if a user opens up the file for the previous month?

Thanks,

Even
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
What is based on the month - the file name? If so, is it consistent for all months? Then use Mid or Left or Right functions to compare the date part of the name to the month part of the date; if text based month name, perhaps
Left(thisworkbook.name,3) = format(month(date),"mmm")

Note: just tested and Month(Date) returns 2. Format(Month(Date),"mmm") returns "Jan" which is odd. Rather than continue on a path that might not fit your requirements I'll just post the suggestion and see if I can figure out why for my own edification. Maybe your file name contains numbers for dates anyway.
 
Upvote 0
Figured out why I'm getting Jan with that (and how to get the month name), but will await your info re how you're naming the files.
 
Last edited:
Upvote 0
Thanks for your reply. The name of the file is the same each month. We just save it in a different folder for each month. The name of the month is in cell A2.
 
Upvote 0
But maybe it's best to change the name of the file for each month???
 
Upvote 0
I'd have filenames like myWorkBook02162022.xlsm, all in one folder if at all possible. My habit is no spaces or special characters in any object, and that includes folder names. Just makes for easier coding. If you thought it still necessary, you could check the month portion of such a name and compare it to the present month but your message won't show in the current month regardless of what year it is. You might want to compare year and month if reading file names with dates.

However, I think you're suggesting that none of this would be necessary if the filename contained the date as users would know which file to open. I'd agree with that, but you know how people can be.
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,850
Members
449,051
Latest member
excelquestion515

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