I am working on an excel export from a wiev. The agent takes the content of the view and exports it out to an excel sheet.
This works fine, but how do get it to wrap the text in the excel sheet ? I want it to export 100 characters, then create a new line and continue with the text there.
When you have selected your cell range, you should be able to use the properties ColumnWidth to set the number of characters you would like the cell to be and the WrapText property of the range to set the cells in question to wrap the text (by setting it to true)
Unfortunately, i don’t have any code to give you, but this should work. Check the VBA help in Excel for more info.
To wrap text try - excelApp.ActiveSheet.Range(“A1”).WrapText = True
To size a column try -
excelApp.ActiveSheet.Range(“A1”).Width = 100 (in points, don’t know if a point is the same size as a character, you’ll have to experiment with this one)
Or
excelApp.ActiveSheet.Columns(columnLetter).ColumnWidth = 100 (again, not sure of the size here)