Current location - Health Preservation Learning Network - Slimming men and women - VB.NET gets the contents of Excel cells.
VB.NET gets the contents of Excel cells.
Adjust xlApp to the new Excel. app; application

Adjust xlBook to Excel. exercise book

Adjust xlSheet to Excel format. worksheet

Show xlRange as Excel. range

Dim strTmp As String = " "

xlApp = CreateObject("Excel。 Application ")

xlBook = xlApp。 Workbooks.Open(txtfileName。 Text)

xlSheet = xlBook。 Worksheet (1)

xlApp。 Visible = false

xlRange = xlSheet。 Cell (1, 1)

StrTmp = xlRange。 Value' reads the value of the first row and the first column, and the rest can be written by yourself.

xlApp。 Application.Visible = False

xlBook。 Close ()

XlApp = Nothing' "Returns control to Excel.

XlBook = none

XlSheet = none