Hi
I receive a file from SQL where all the columns are formatted as "General" I would like to write a batch file to change them all to Text
I found this bs file that changes the font, but what would I use to change the format?
Thanks
'launch Excel and open file
Set xlObj = CreateObject("Excel.Application")
Set xlFile = xlObj.WorkBooks.Open("c:\temp\filename.xls")
'turn off screen alerts
xlObj.Application.DisplayAlerts = False
'loop through sheets
For Each Worksheet In xlFile.Worksheets
'change sheet to desired worksheet name
If Worksheet.Name = "SheetToRename" Then
Worksheet.Name = "NewName"
End If
'change all sheets to desired font
With Worksheet.Cells.Font
.Name = "Verdana"
.Size = 12
End With
Next
'save, close, then quit
xlFile.Close True
xlObj.Quit
I receive a file from SQL where all the columns are formatted as "General" I would like to write a batch file to change them all to Text
I found this bs file that changes the font, but what would I use to change the format?
Thanks
'launch Excel and open file
Set xlObj = CreateObject("Excel.Application")
Set xlFile = xlObj.WorkBooks.Open("c:\temp\filename.xls")
'turn off screen alerts
xlObj.Application.DisplayAlerts = False
'loop through sheets
For Each Worksheet In xlFile.Worksheets
'change sheet to desired worksheet name
If Worksheet.Name = "SheetToRename" Then
Worksheet.Name = "NewName"
End If
'change all sheets to desired font
With Worksheet.Cells.Font
.Name = "Verdana"
.Size = 12
End With
Next
'save, close, then quit
xlFile.Close True
xlObj.Quit