Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() You can do the entire sheet with... objWorksheet.Cells.HorizontalAlignment = -4108 --or-- maybe this would be more efficient... objRange1.Cells.HorizontalAlignment = -4108 -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "jonezn" wrote in message 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? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If
objWorksheet.Cells(1, 7).HorizontalAlignment = -4108 works on a single cell then objWorksheet.Cells.HorizontalAlignment = -4108 should work on all the cells -- Gary''s Student "jonezn" wrote: 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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
HOW DO I CENTER TEXT WITHIN A CELL? | New Users to Excel | |||
center text | Excel Discussion (Misc queries) | |||
Center text in dialog box | Excel Worksheet Functions | |||
How to center text in a msgbox | Excel Programming | |||
Creating properly formatted text file from vbscript using excel data | Excel Programming |