By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 2,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

Autosaving file by date as part of the file name

P: 1
When I use this code the file is only saved at:
c:\MarketActions and not in the subfolder \Egypt.

Where is the problem?

Expand|Select|Wrap|Line Numbers
  1. Sub SaveFile()
  2. ActiveWorkbook.SaveAs ("c:\MarketActions\Egypt\" _
  3.  & Format(Now(), "YYYYMMDDHHMM") & ".xlsm")
  4. End Sub
  5.  
Please advise
Aug 18 '15 #1
Share this Question
Share on Google+
1 Reply


Expert Mod 2.5K+
P: 2,545
On the basis that there is nothing obvious wrong in what you have posted I suspect that this sub may not be executed as it stands. If the sub folder Egypt was incorrectly named, say, Excel would tell you that the path was invalid. If you have Excel's warning messages turned off then you would not get notification of an error, but nor would the file be saved. Saving one folder up is not behaviour that I recognise.

I suggest you set a breakpoint in the code which calls the sub, then step through it line by line to check what is going on. Make sure you start with no previous files saved in your folders to avoid potential confusion of your tests.

-Stewart
Aug 19 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.