1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
Imports System
Imports System.Data
Imports System.Web
Imports System.IO
Imports Microsoft.Office.Interop
Public Class Form1
Dim opfile As String
Private oExcelApp As Excel.ApplicationClass
Private oBooks As Excel.Workbooks
Private oBook As Excel.Workbook
Private oSheet As Excel.Worksheet
Private oRien As Object
Private nIndex As Integer
Private strTemplate As String
Private strExportFormat As String
Private strCache As String
Private Sub QuitterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitterToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles od.FileOk
End Sub
Private Sub OuvrirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OuvrirToolStripMenuItem.Click
od.InitialDirectory = "c:\"
od.Filter = "xls files (*.xls)|*.xls|cvs file (*.cvs)|*.cvs"
od.FilterIndex = 2
od.RestoreDirectory = True
If od.ShowDialog() = DialogResult.OK Then
opfile = od.FileName
Label1.Text() = opfile
oExcelApp = New Excel.ApplicationClass()
oExcelApp.Visible = False
oBooks = oExcelApp.Workbooks
oBook = oBooks.Open(opfile, oRien, oRien, oRien, oRien, oRien, oRien, oRien, oRien, oRien, oRien, oRien, oRien, oRien, oRien)
' oSheet = oBook.Worksheets(0)
End If
End Sub
End Class |
Partager