PDA

View Full Version : Renaming a closed excel file by info in it, Excel VBA



Manucas18
07-31-2018, 04:29 AM
Hello everyone.
I would like to know how can i change a file name of a closed file, taking into account an if condition.
Therefore, in specific:
1. The purpose of the code is oriented to, if i don't have the file open, i can see its name and realize that something changed or not in the sheet;
2. The condition is supposed to be definied by the cell color or an associated date, so, if at least one cell of a group of cells have a specific color (that's defined by conditional formatting) or considering a proximity of 45 days from the established dates in the cells, then the name of the file would change and would include a letter, a character or something else at the beggining of the file name, to signal that the sheet needs changes without spend time opening it;
3. Once the changes were made and the condition was not checked, the file would be renamed again to the original name;

The changing of the name i think could be done with the "Name... As..." funtion, and the if condition refering to the colors i think isn't a problem too.

But, where should i put the code? What procedure and funtions should be defined so the name can update in function of the cells colors, not neglecting the fact that the file is closed?


If somenone can help me, i would appreciate.
Thank You in advance.
BR