1 / 6

VB.NET and Excel

VB.NET and Excel. VB.NET allows you to write code to manipulate Excel. You can create, open, and save Excel files. You can read data from Excel. You can write data to Excel. You can create charts, pivot tables, and more.

karli
Télécharger la présentation

VB.NET and Excel

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VB.NET and Excel • VB.NET allows you to write code to manipulate Excel. • You can create, open, and save Excel files. • You can read data from Excel. • You can write data to Excel. • You can create charts, pivot tables, and more. • This can be very useful for generating output data in a widely-used format that is easy to display, print, and manipulate.

  2. Can Be Tricky • When it works, creating Excel files from VB is pretty easy. • Unfortunately, it doesn’t always work, and I don’t know why. • Therefore, I want to make you aware that you can do it, and show you how to do it… • Assuming that it will work on the computer that you are using.

  3. Adding a Reference • To be able to manipulate Excel from a VB.NET program, you must add a reference to Excel.

  4. Creating an Excel File • Excel code doesn’t work well with Option Strict being On; therefore, I turned it off. • This code creates a new Excel file and writes some data to it.

  5. Modifying an Existing Excel File • Locate the file using an OpenFileDialogor other means. • After that, writing to an existing file is the same as to a new file.

  6. Read From a File • Connect to the file in the same way. • Read the “value2” property of the Cells that you want to import into your program. • All of these examples are in the “ExcelOutput.zip” program, available in today’s lecture materials.

More Related