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
| Private Sub Command1_Click()
Dim xlapp As Excel.Application 'Application Excel
Dim xlbook As Excel.Workbook 'Classeur Excel
Dim xlsheet As Excel.Worksheet 'Feuille Excel
Dim i As Integer
Dim Chemin As String
Chemin = "\\BATAX352\Rapact\WorkOrder.xls"
Set xlapp = CreateObject("Excel.Application") 'Ouverture de l'application Excel
Set xlbook = xlapp.Workbooks.Open(Chemin) 'Ouverture d'un fichier Excel
Set xlsheet = xlbook.Sheets("Feuil1") 'Ouverture de la feuille1 du fichier Excel
xlapp.Visible = True 'Rend visible l'pplication Excel
xlapp.Cells(17, 3) = Form1.Combo1
xlapp.Cells(17, 5) = Form1.Text14
xlapp.Cells(21, 3) = Form1.Text1 & ", " & Form1.Combo2 & ", " & Form1.Text6
xlapp.ActiveSheet.PrintOut
xlapp.DisplayAlerts = False
xlapp.Windows(1).Close savechanges:=False
xlapp.Quit 'Quitte l'application Excel
Set xlsheet = Nothing
Set xlbook = Nothing
Set xlapp = Nothing
End Sub |
Partager