I create a Excel file and try to alignment text to the middle in the cells for the first row with this code:
Dim ExcelSheet As Object
Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelSheet.Application.Cells(1, 1).Value = "Test"
ExcelSheet.Application.Rows(1).HorizontalAlignment = xlCenter
ExcelSheet.SaveAs "H:\TEST3.XLS"
ExcelSheet.Application.Quit
Set ExcelSheet = Nothing
But i got the error message: "Cannot set HorizontalAlignment-property to the Range-Class". Somebody know how I can fix this?
Dim ExcelSheet As Object
Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelSheet.Application.Cells(1, 1).Value = "Test"
ExcelSheet.Application.Rows(1).HorizontalAlignment = xlCenter
ExcelSheet.SaveAs "H:\TEST3.XLS"
ExcelSheet.Application.Quit
Set ExcelSheet = Nothing
But i got the error message: "Cannot set HorizontalAlignment-property to the Range-Class". Somebody know how I can fix this?