Shows notification and file will closed.

Anonymous
2015-04-18T16:27:12+00:00

I want to show notification when MS Excel 2010 file open that "This file is expired" and after click on Ok Button, file will automatically closed.

It will happen when I set a period approximately one month or a year, the file is opened or used is stop working.

Please help me on this matter.

Thanks

Muneeb

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
OssieMac 47,631 Reputation points
2015-04-26T23:31:09+00:00

Hello again Muneeb,

It works fine for me. I can save as macro enabled workbook without any problems. A copy of the workbook at the following link.

http://1drv.ms/1EGUPMq

I have not protected the VBA project in the uploaded example. I have left that for you to do as per my previous instructions.

Are you trying to save on a server that has protection that will not allow macros? If so, try saving to the hard disk on your computer and see what happens. If it works on your local hard disk then the Server security is possibly the problem so see you system administrator.

If you cannot save to your hard disk on the computer then you need to investigate whether your security software on your computer will not allow files with macros. If this is the case then contact the support people for the security software and see if there is anything you can do about it.

Was this answer helpful?

0 comments No comments
Answer accepted by question author
OssieMac 47,631 Reputation points
2015-04-26T11:32:50+00:00

But the file is not saving as Macro enabled

It shows the following Message

Errors were detecting while saving "Path & Filename". Microsoft Excel may be able to save the file by removing or repairing some features. To make the repairs in a new file, click Continue. To cancel the saving file, click Cancel.

Const ExpirationDate = #5/25/2015#

Const ExpirationDate = #25/5/2015#

Hello Muneeb,

Firstly I am surprised that Excel accepted the date in d/m/y format. My local date format is d/m/y and if I insert the date that way then it automatically changes it to m/d/y format if the day is greater than 12. If the day is not greater than 12 then I finish up with the wrong date. If I enter the date as #25 May 2015# then it also changes the date to #5/25/2015#

I don't suppose you are attempting to insert this macro with the on-line version of Excel. I haven't tried creating a macro with it but to the best of my knowledge, it does not work.

The error message indicates to me that it cannot save the workbook as Macro enabled. This can occur if there is an error in the code that needs fixing before saving. Try inserting the following line at the very top of the page in the VBA editor. (Before the Const declarations.)

Option Explicit

After you have inserted the above line, click on menu item Debug then Compile VBA Project. If Compile VBA Project is disabled (Greyed out) then at some place in the code insert a blank line so the Excel thinks you have made a change. (To do this, position the cursor at the end of a line and press Enter.) and then Select Debug -> Compile VBA Project.

When the code is compiled, if there is a problem in the code that will prevent saving then the debugger will stop on the line and highlight it.

If this does not work then can you upload a copy of the workbook for me.

Guidelines to upload a workbook on OneDrive:

  1. Zip your workbooks. Do not just save to OneDrive because the workbooks open with On-Line Excel and the limited functionality with the On-Line version causes problems.
  2. To Zip a file: In Windows Explorer Right click on the selected file and select Send to -> Compressed (zipped) folder.)
  3. Do not use 3rd party compression applications because I cannot unzip them. I do not clog up my computer with 3rd party apps when there are perfectly good apps supplied with windows.
  4. Go to this link.  https://onedrive.live.com
  5. Use the same login Id and Password that you use for this forum.
  6. Select Upload in the blue bar across the top and browse to the zipped folder to be uploaded.
  7. Select Open (or just double click). (Be patient and give it time to display the file after initially seeing the popup indicating it is done.)
  8. Right click the file on OneDrive and select Share.
  9. Do NOT fill in the form; Select "Get a Link" on the left side.
  10. Click the button "Create a Link"
  11. Click in the box where the link is created and it will highlight.
  12. Copy the link and paste into your reply on this forum.

Was this answer helpful?

0 comments No comments

12 additional answers

Sort by: Oldest
  1. OssieMac 47,631 Reputation points
    2015-04-19T07:15:28+00:00

    I am a bit confused but maybe just need a little more explanation. What is the point in keeping the file if no one can open and view it just because it has expired?

    I think that the message to the user should be something like "This file is expired. Do you still want to open it?" The user should then be able to answer "Yes" or "No". It is possible to do this and even apply protection to the worksheets so it is read only and prevent alteration. It will require a VBA solution in the Workbook Open event. Is this what you want?

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2015-04-19T15:59:42+00:00

    Dear OssieMac

    Sorry for inconvenience.

    Academic Reason

    Little bit Introduction to us, We are the Head of Affiliated Colleges, and they are all worked under our rules and regulations.

    The file is being used by plenty of affiliated colleges and we are allow them to use it. For some reasons syllabus can be change So if any institution used the previous syllabus which is informed as Outdated or Obsolete already to them, that could be little headache to us, we can handle it through some legal actions but we don't want to do that.

    Just we need that help when we announced that this will be obsoleted to this Date Month or Year then File will not be open. It will continue our good relations among them.

    The Message to user must be like this "The file is expired. As we give clear Legal Notice to you."

    The user should then be able to answer "Ok" and then file will closed.

    May be this explanation will clear your thought, if Not please feel free to ask any more explanation.

    Thanks for your prompt response.

    Regards

    Muneeb

    Was this answer helpful?

    0 comments No comments
  3. John Korchok 237.1K Reputation points Volunteer Moderator
    2015-04-19T19:56:41+00:00

    A macro solution can always be bypassed. All the user has to do is not enable the macro when opening the file and they'll be able to use the obsolete content. However, here is a page that discusses the issues: Time Limiting a Workbook

    Have you looked into some type of web syndication as a means of information distribution? Your institution would host master pages that are revised on your schedule and the subordinate colleges would simply redisplay that material without having direct access to the source.

    Was this answer helpful?

    0 comments No comments