Imports Microsoft.Office.Interop.Excel
Private Sub doExport(ByVal ds As DataSet, ByVal strExcelFileName As String)
Dim myxlapp As New Microsoft.Office.Interop.Excel.Application
Dim rowindex As Integer = 1
Dim colindex As Integer = 0
myxlapp.Workbooks.Open( "F:\gongshang\comexcel.xls ", 0, False, 5, " ", " ", False, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, " ", True, False, 0, True, False, False)
Dim ws As Worksheet = myxlapp.Workbooks.Item(1).Sheets.Item(1)
Dim ran As Range = ws.Cells.Item(1, 1)
ran.Text = "adfasdfafdaf "
myxlapp.Workbooks.Close()
myxlapp.Quit()
myxlapp = Nothing
GC.Collect()
End Sub
ran.Text = "adfasdfafdaf "
提示ran.text属性为readonly
只能读出来,如何能写进去?
------解决方案--------------------------------------------------------
CELL不是简单的TEXT
你要写数据 要指定好数据类型和格式以及值(可能是数字、符点、文字等)然后SET回去 所以TEXT属性是只读的, 不能直接写