View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jonezn jonezn is offline
external usenet poster
 
Posts: 1
Default VBScript to center Text

I can use this to open the csv file and autofit/sort it. Now how do you
center the entire sheet not just one cell?

Const xlAscending = 1
Const xlYes = 1

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = _
objExcel.Workbooks.Open("h:\Test.csv")


Set objWorksheet = objWorkbook.Worksheets(1)
Set objRange1 = objWorksheet.UsedRange
Set objRange2 = objExcel.Range("A1")
objRange1.Sort objRange2, xlAscending, , , , , , xlYes

Set objRange = objExcel.Columns("A:K").AutoFit

this line does a cell.
objWorksheet.Cells(1, 7).HorizontalAlignment = -4108

how can you do the entire workbook?