I am new to loops inside VBA. but I do understand the concept behind them.
Situation:
I have a list of folders: (will call this variable: foldername)
c:\documents\FolderA
c:\documents\FolderB
c:\documents\FolderC
every weekdday I save a folder inside each of the folders with the date as the name of the folder. (daily dated reports). there are no dated folders for the weekends and holidays. (so not consitant to have all days of 1-31)
in FolderA there is a folder 6/01/11, 6/02/11, 6/03/11... (will call These variables rptmonth/rptdate/rptyear). each of the other folders has similar folders (6/01/11....)
In reality there are 30 folders but I am simplifying so that I can get the basics of the coding.
on 7/1, I manually go in and delete all entries from June from these files....this is done on a monthly basis. I would like to automate this with a macro.
Prior to doing the following questioned items, I know I need to (and know how to)
due to there not being a report on every day, I know that somewhere an onerror message will need to be used. (I have used those on other things)
Situation:
I have a list of folders: (will call this variable: foldername)
c:\documents\FolderA
c:\documents\FolderB
c:\documents\FolderC
every weekdday I save a folder inside each of the folders with the date as the name of the folder. (daily dated reports). there are no dated folders for the weekends and holidays. (so not consitant to have all days of 1-31)
in FolderA there is a folder 6/01/11, 6/02/11, 6/03/11... (will call These variables rptmonth/rptdate/rptyear). each of the other folders has similar folders (6/01/11....)
In reality there are 30 folders but I am simplifying so that I can get the basics of the coding.
on 7/1, I manually go in and delete all entries from June from these files....this is done on a monthly basis. I would like to automate this with a macro.
Prior to doing the following questioned items, I know I need to (and know how to)
- do the dim statements as strings and integers depending on the variable,
- do an imput box to define rptmonth as whatever the current month number is,
- do an imput box to define rptyear as the current year
- open "c:\documents\FolderA" (the first folder on the list - first foldername)
- kill "c:\documents\FolderA\" & rptmonth & "/" & rptday & "/" & rptyear"
- do rptday = rptday+1
- repeat 2 and 3 until rptday = 31
- do rptday = 1
- open ""c:\documents\FolderB" (the next folder on the list) ...ie foldername = foldername +1 when looking at the list
- repeat 2-6 until all folders in the list have had their files deleted
due to there not being a report on every day, I know that somewhere an onerror message will need to be used. (I have used those on other things)