1

I need my code to create a folder named with german month: not 05 March but 05 März

Dim strMonth  As String
 strMonth =  Format(Date, "mm")
 ' Check for month folder and create if needed
If Len(Dir("C:\Users\Luca\Desktop\TestDaty\" & client & "\" & Year(Date) & "\" & strMonth & " " & MonthName(Month(Date), False), vbDirectory)) = 0 Then
    MkDir "C:\Users\Luca\Desktop\TestDaty\" & client & "\" & Year(Date) & "\" & strMonth & " " & MonthName(Month(Date), False)
End If

so maybe some country code here? MonthName(Month(Date) Please help me!!! :)

braX
  • 11,506
  • 5
  • 20
  • 33
Lucy
  • 13
  • 2
  • You could store the translation of all English months and corresponding German months as key:value pairs in a dictionary. And then do `month_in_german = dict(month)`. – Manik May 23 '20 at 20:03

1 Answers1

7

If your locale is set to German I guess something like Format(Date, "mmmm") should do (works for me). Otherwise, if you just need to create German named folders you can use a language-code (LCID) in combination with WorksheetFunction.Text():

WorksheetFunction.Text(Date, "[$-407]mmmm")

Where [$-407] is the language-code to return a German monthname!

JvdV
  • 70,606
  • 8
  • 39
  • 70
  • 1
    Thank you so much for a quick anwer!!! strMonth = WorksheetFunction.Text(Date, "[$-407]mmmm") works perfect for me! – Lucy May 24 '20 at 12:44
  • FYI You might be interested having a look a related multilingual function at [Create a calendar input in VBA-Excel](https://stackoverflow.com/questions/54650417/how-can-i-create-a-calendar-input-in-vba-excel/54689596#54689596) – T.M. May 24 '20 at 19:30