Changing folder reference with user input in VBA for Excel

M

Marita

I have a macro that updates numerous files. The file paths
are recorded in the code. However, the folder name
changes monthly(Oct, Nov, etc). How can I best write a
macro that will edit/replace the folder name?

Any help will be appreciated.
Marita
 
L

losmac

Sub EnumDirs()
Dim userPath As String
Dim i As Long

userPath = "C:\My Documents\"

'for each months in year
For i = 1 To 12
MsgBox userPath & Format(DateSerial(Year(Date), i, Day
(Date)), "mmmm"), vbInformation, "Month of Year"
Next i

'current month
MsgBox userPath & Format(DateSerial(Year(Date), Month
(Date), Day(Date)), "mmmm"), vbInformation, "Current Month"

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top