Converting Column CellFormats in a script file

J

Jimi

Hi

Im writing a script file to convert a CSV to a XLS and format some of the
columns into a particular date format.

So far this is where I'm at:
Dim appExcel
Dim wbSource

On Error Resume Next
Set appExcel = CreateObject("Excel.Application")
appExcel.DisplayAlerts = False
Set wbSource = appExcel.Workbooks.Open("C:\temp\Comm.csv")

wbSource.SaveAs "C:\temp\Comm.xls", 39
wbSource.Close False

Set wbSource = Nothing
appExcel.Quit
Set appExcel = Nothing

This converts the CSV to a XLS, but I don't know how to format the columns
to a custom (dd/mm/yyyy) date format (btw, the data starts on the 2nd line
of the spreadsheet since the first line is headings). Anyone with any ideas?

Thanks
Jimi
 
P

Peter Atherton

Jimi
Put a select statement in and then

With Selection
.NumberFormat = "dd/mm/yy"
End With

Regards
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top