hi! can some one give me a code for exporting listview data to excel? thanks
sigridish
0
Junior Poster in Training
Recommended Answers
Jump to PostAssuming you have an Excel file on D: named myfile.xls, you can access it as follows:
Dim xls As New Excel.Application Dim sheet As Excel.Worksheet xls.Workbooks.Open("D:\myfile.xls") sheet = xls.Workbooks(1).Worksheets(1) sheet.Cells(1,1) = "abc" sheet.Cells(1,2) = "def" sheet.Cells(1,3) = "ghi" xls.SaveWorkspace() xls.Quit
That will set the first three columns …
Jump to PostCreate a new form. Add a reference to "Microsoft Excel 11.0 Object Library". At least that's the name on my PC. The version number may be different on yours.
Add two buttons named btnPopulate and btnExport. Add a listview named lvwToExport and set it to details view. Make sure …
Jump to PostI'll leave that as an exercise for the student. Read up on the ListView control and play around a bit and you'll find out how to get the column names from the control. Or, if you already know the column names you should be able to write the code to …
All 10 Replies
sigridish
0
Junior Poster in Training
Reverend Jim
4,780
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
sigridish
0
Junior Poster in Training
Reverend Jim
4,780
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
sigridish
0
Junior Poster in Training
Reverend Jim
4,780
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
sigridish
0
Junior Poster in Training
sigridish
0
Junior Poster in Training
Reverend Jim
4,780
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
sigridish
0
Junior Poster in Training
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.