ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Converting Column CellFormats in a script file (https://www.excelbanter.com/excel-programming/278089-converting-column-cellformats-script-file.html)

Jimi[_2_]

Converting Column CellFormats in a script file
 
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



Peter Atherton

Converting Column CellFormats in a script file
 
Jimi
Put a select statement in and then

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

Regards
Peter
-----Original Message-----
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


.



All times are GMT +1. The time now is 08:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com