Save file with English format Month name

EvilC

Board Regular
Joined
Jul 26, 2014
Messages
74
Hey all,

I have a workbook that after updating needs to be saved without any linked formulas and into a monthly file.
Now i am in Portugal what means that when formatting text for my month it uses the Portuguese language in stead of English. Using formulas there is the [$-409] code i can use that does the job very well. Now i have tried that in a macro, but i can not get this to work. Searching the net also gives me no help so ill try here where all the guru's at ;)

What i have:

Code:
Sub CopyValuesNewFile()


    'Copy all external linked formulas and save them as values
    Worksheets("CALCULATIONS").Columns("V").Copy
  
    Worksheets("CALCULATIONS").Columns("V").PasteSpecial xlPasteValues
    
    Worksheets("CALCULATIONS").Range("$D$2:$U$6").Copy
    
    Worksheets("CALCULATIONS").Range("$D$2:$U$6").PasteSpecial xlPasteValues
  
    'Hide helper Tabs
    Worksheets("CALCULATIONS").Visible = xlSheetVeryHidden
    Worksheets("Addons").Visible = xlSheetVeryHidden
    Worksheets("Control").Visible = xlSheetVeryHidden
          
    'Set new filename and date
    Dim Mon As String, Ye As String, wbName As String, xWB As Workbook
      
    wbName = "Philips_Forecast_Benelux_Draft_"
    Mon = Format(CStr(Now), "[$-409]mmmm")
    Ye = Format(CStr(Now), "_yyyy")
    
    'Disable Excel warnings
    Application.DisplayAlerts = False
    
    'Goto First Sheet
    Worksheets("DASHBOARD CC").Activate
    Range("A1").Activate
      
    'Save new file in right path
    ActiveWorkbook.SaveAs Filename:="\\inffs223\MissionControl\MC\P.EMEA.PHIL_207\01 - Forecast & Sizing\02 - FORECAST\04 - VALIDATION\" & wbName & Mon & Ye, FileFormat:=51, CreateBackup:=False
      
    'Enable Excel warnings
    Application.DisplayAlerts = True
  
End Sub

Thanks in advance for any input.
 

Some videos you may like

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,110
Office Version
  1. 365
Platform
  1. Windows
This seems to work:

Code:
Mon = WorksheetFunction.Text(Now, "[$-409]mmmm")

I just managed to get some Italian changing it to 410 anyway.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,811
Office Version
  1. 365
Platform
  1. Windows
How did this not work, it works for me?
Code:
 Mon = Format(CStr(Now), "[$-409]mmmm")
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,811
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

I still get English too, so it doesn't look as though it works or the [$-409] part is being ignored.:)
 

EvilC

Board Regular
Joined
Jul 26, 2014
Messages
74
Hey Steve,Norie,

For me it does not work, As you guys are in the UK you might not see any difference as your local language is English.

Changing it to 410 still saves it with the local month name "outubro" for me..
 

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,110
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Yeah it looks like it uses the locale of the machine disregarding the [$-409] in the format method but in the worksheetfunction.text the [$-409] is used. Seems that way anyway.
 

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,110
Office Version
  1. 365
Platform
  1. Windows
Hey Steve,Norie,

For me it does not work, As you guys are in the UK you might not see any difference as your local language is English.

Changing it to 410 still saves it with the local month name "outubro" for me..

Even using worksheetfunction.text? Thats odd as i can get different languages using that.
 

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,110
Office Version
  1. 365
Platform
  1. Windows
I can get portuguese too:

Code:
Mon = Format(Now, "[$-0816]mmmm")
Debug.Print Mon
Mon = WorksheetFunction.Text(Now, "[$-0816]mmmm")
Debug.Print Mon

produces:

October
outubro

in the immediate window
 

EvilC

Board Regular
Joined
Jul 26, 2014
Messages
74
I can get portuguese too:

Code:
Mon = Format(Now, "[$-0816]mmmm")
Debug.Print Mon
Mon = WorksheetFunction.Text(Now, "[$-0816]mmmm")
Debug.Print Mon

produces:

October
outubro

in the immediate window

This did the Job. Happy guy :)

Thanks for your help.
 

Watch MrExcel Video

Forum statistics

Threads
1,108,621
Messages
5,523,947
Members
409,543
Latest member
LaMaqu1na

This Week's Hot Topics

Top