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 48,006 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 48,006 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: Most helpful
  1. Anonymous
    2015-04-27T17:25:39+00:00

    Hello OssieMac

    THIS IS THE SOLUTION TO MYQUERIES

    I'M GRATEFUL TO MICROSOFT COMMUNITY

    BEST REGARDS

    Muneeb

    Was this answer helpful?

    0 comments No comments
  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Anonymous
    2015-04-26T16:08:20+00:00

    Hello OssieMac

    It's the link given below that you ask for

    https://onedrive.live.com/redir?resid=C748724CC5ADE484!137&authkey=!AACWnP2Uc6a60E8&ithint=file%2czip

    Regards

    Muneeb

    Was this answer helpful?

    0 comments No comments