Link to home
Start Free TrialLog in
Avatar of venkatesh Sarivisetty
venkatesh SarivisettyFlag for India

asked on

How to get the output file name as Month Year(September 2017) in VB script

How to get the output file name as Month Year(September 2017) in VB script
Avatar of Shums Faruk
Shums Faruk
Flag of India image

Hi Try below:
ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "\Your Folder name" & Format(Date, mmm yyyyy) & ".xlsx"

Open in new window

Do you want VB Script or VBA?
Even its vbs, you just need to add Excel Object in front of above code:
Set objExcel = CreateObject("Excel.Application")
objExcel.ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "\Your Folder name" & Format(Date, mmm yyyyy) & ".xlsx"

Open in new window

Avatar of Norie
Norie

What type of file is the output file and how have you created/produced it?
ASKER CERTIFIED SOLUTION
Avatar of Dorababu M
Dorababu M
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of venkatesh Sarivisetty

ASKER

THANKS SIR. IT WORKED WELL!!!
Please try this:

MonthYear = MonthName(Month(Date)) & " " & Year(Date)

Open in new window


»bp