Hi,
i need to export a listbox data to an xls file, how i can do this?
thanks

You can use ODBC to output a dataset or datatable directly to an excel file without the need of automating Excel itself or even requiring the user to have Excel installed. In this case, I would fill a datatable and bind it to your listbox and then export to the excel file.

This method is very easy and fast and doesnt require automating Excel in order to write the file. It doesnt even require the user to need Excel installed on there PC. However since your not actually using Excel, you do lose some functionality such as the ability to format cells in the worksheet (no bolding header lines, resizing columns etc)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.