Hello, I tried to google hardly, but can't get macro working, always as month showing January
This is code I have
File which I want to open will be in "C:\GENERAL\2023\07 July\ or either another month
This is code I have
VBA Code:
Sub test3()
Dim dt As String, dt2 As String
Dim filename As String, strMonth As String
strMth = MonthName(Month(Now()))
If Month(Now()) = 1 Then
mth = "1"
strPriorMth = MonthName(12, True)
Else
mth = Month(Now() - 1)
strPriorMth = MonthName(Month(Now()) - 1, True)
End If
dt = Format(mth, "mm")
dt2 = Format(mth, "mmmm")
filename = "C:\GENERAL\2023\" & dt & " " & dt2 & "\" & "Handover*.xlsm"
Debug.Print filename
'Workbooks.Open filename
End Sub