cetee
¼‰„e: ÂÔÓÐС³É
|
vb.net ÇóÖú£¬Õˆ´ó¼Ò?gu¨©)Íæ¡£ÖxÖx Imports excel = Microsoft.Office.Interop.Excel Imports System.IO Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click Dim fileTest As String = "c:\Temp\ExcelTest\test.xlsx" If File.Exists(fileTest) Then File.Delete(fileTest) End If Dim oexcel As Object oexcel = CreateObject("excel.Application") Dim obook As excel.Workbook Dim osheet As excel.Worksheet obook = oexcel.Workbooks.Add osheet = oexcel.Worksheets(1) osheet.Name = "test name" osheet.Range("A").Value = "button 1" obook.SaveAs(fileTest) obook.Close() obook = Nothing oexcel.Quit() oexcel = Nothing End Sub End Class |
---|---|
|