Hello there, I am working on a math program that will record student answers and export them to an excel spreadsheet from a listview called ResultsView.
I can export the data to the right columns, but once the data is exported, I would like to be able to change the width of the columns of the spreadsheet, sort of like you can do in a listview.
I export the data this way, and it will do the job well, but is there an option to change the width of the columns?
Thank you!!!
I can export the data to the right columns, but once the data is exported, I would like to be able to change the width of the columns of the spreadsheet, sort of like you can do in a listview.
I export the data this way, and it will do the job well, but is there an option to change the width of the columns?
VB Code:
Dim ExcelObj As Object Dim ExcelBook As Object Dim ExcelSheet As Object Dim i As Integer Set ExcelObj = CreateObject("Excel.Application") Set ExcelBook = ExcelObj.WorkBooks.Add Set ExcelSheet = ExcelBook.WorkSheets(1) With ExcelSheet 'For i = 1 To ResultsView.ColumnHeaders.Count ' .cells(1, i) = ResultsView.ColumnHeaders(i).Text ' Next i ' This code below will print the resultsview listview columns into the excel spreadsheet For i = 1 To ResultsView.ListItems.Count .cells(i + 1, 1) = ResultsView.ListItems(i).Text .cells(i + 1, 2) = ResultsView.ListItems(i).SubItems(1) .cells(i + 1, 3) = ResultsView.ListItems(i).SubItems(2) .cells(i + 1, 4) = ResultsView.ListItems(i).SubItems(3) .cells(i + 1, 5) = ResultsView.ListItems(i).SubItems(4) .cells(i + 1, 6) = ResultsView.ListItems(i).SubItems(5) .cells(i + 1, 7) = ResultsView.ListItems(i).SubItems(6) Next End With ExcelObj.Visible = True