I have created a query and exported it to Excel.
I'm at the point of saving my ActiveWorkbook as follows:
objXL.ActiveWorkbook.SaveAs FILENAME
I wanted to create a unique file name each time the Excel file gets generated. How would I create a unique filename so that the first time a file named C:\FALL1.XLS
gets generated ?
Then, perhaps a week later, generate the same Excel file and save the file as C:\FALL2.XLS
Then, if I subsequently delete C:\FALL2.XLS, the next time I generate the file, it would be saved as C:\FALL2.XLS again.
Thus, the C:\ root directory would be searched to see the next available generation number of C:\FALL(incremented number).XLS to create. I am trying to figure how to do this programatically using VBA.
I'm at the point of saving my ActiveWorkbook as follows:
objXL.ActiveWorkbook.SaveAs FILENAME
I wanted to create a unique file name each time the Excel file gets generated. How would I create a unique filename so that the first time a file named C:\FALL1.XLS
gets generated ?
Then, perhaps a week later, generate the same Excel file and save the file as C:\FALL2.XLS
Then, if I subsequently delete C:\FALL2.XLS, the next time I generate the file, it would be saved as C:\FALL2.XLS again.
Thus, the C:\ root directory would be searched to see the next available generation number of C:\FALL(incremented number).XLS to create. I am trying to figure how to do this programatically using VBA.