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
| If (Text1.Value <> "") Then
NomFic = Text1
NomFic = NomFic & ".xls"
Else
réponse = MsgBox("Nom de fichier à importer manquant", vbExclamation + _
vbOKOnly, "ATTENTION!!!")
Exit Sub
End If
If (Text2.Value <> "") Then
PathFic = Text2
Else
réponse = MsgBox("Emplacement du fichier à importer manquant", vbExclamation + _
vbOKOnly, "ATTENTION!!!")
Exit Sub
End If
If (Text3.Value <> "") Then
NomSheet = Text3
Else
réponse = MsgBox("Nom de la feuille d'importation est manquant", vbExclamation + _
vbOKOnly, "ATTENTION!!!")
Exit Sub
End If
Set ClasseurXLS = CreateObject("Excel.application")
ClasseurXLS.Visible = True
ClasseurXLS.UserControl = True
ClasseurXLS.Workbooks.Open PathFic & NomFic
ClasseurXLS.Sheets(NomSheet).Activate |
Partager