I want to modify the column’s number format automatically in excel.
Set excel = CreateObject("Excel.Application")
Set oWB = excel.Workbooks.Open("E:\Docs\Invoice.csv")
/* Excel Macro starts */
Columns("G:G").Select
Selection.NumberFormat = "m/d/yyyy"
Columns("H:H").Select
Selection.NumberFormat = "0.00"
/* Excel Macro ends */
oWB.save
oWB.Application.Quit
I run this .vbs using command line. Excel doc does not get updated.
Could anyone please help me in resolving this issue ?
Thanks in advance
What you are missing in the above code is you are not fully qualifying the Excel Objects.
How would vbs understand what is
Columns("G:G")?Try this
EDIT: My Only concern is that the numberformat will not stay as it is a CSV file. You might want to save it as an Excel file?
CODE