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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
Function validation_soft_bis()
Dim AppliXLS As Excel.Application
On Error GoTo Probleme
Dim iStr_Repertoire As String
iStr_Repertoire = Nz(DLookup("[chemin]", "Param"), "")
'Control présence répetoire de travail.
If iStr_Repertoire = "" Then
MsgBox "Répertoire non défini."
GoTo Fin
End If
' Fin du control
'Déclaration pour application Excel
Set AppliXLS = CreateObject("Excel.Application")
'Ouverture des 2 fichiers Excel
AppliXLS.Workbooks.Open Filename:=iStr_Repertoire & "toto-For creation - Soft.xls"
AppliXLS.Visible = True
AppliXLS.Workbooks.Open Filename:=iStr_Repertoire & "Table avec détail logiciels.xls"
AppliXLS.Visible = True
'Positionnement et traitement
AppliXLS.Windows.Arrange ArrangeStyle:=xlVertical
AppliXLS.Columns("A:C").Select
AppliXLS.Selection.Copy
AppliXLS.Windows("toto-For creation - Soft.xls").Activate
AppliXLS.Sheets.Add After:=Sheets(Sheets.Count)
AppliXLS.Range("A1").Select
AppliXLS.ActiveSheet.Paste
AppliXLS.Sheets("Sheet1").Select
AppliXLS.Sheets("Sheet1").Name = "VALIDATION"
AppliXLS.Windows("Table avec détail logiciels.xls").Activate
Call Flash_clip
AppliXLS.ActiveWindow.Close
AppliXLS.Sheets("TABLE_TOTAL_SOFT").Select
AppliXLS.Windows.Arrange ArrangeStyle:=xlTiled
AppliXLS.Application.WindowState = xlMaximized
AppliXLS.Sheets("TABLE_TOTAL_SOFT").Select
AppliXLS.Sheets("VALIDATION").Select
AppliXLS.Columns("A:A").Select
AppliXLS.ActiveWorkbook.Names.Add Name:="brand", RefersToR1C1:="=VALIDATION!C1"
AppliXLS.Columns("A:A").Select
AppliXLS.ActiveWorkbook.Names.Add Name:="brand", RefersToR1C1:="=VALIDATION!C1"
AppliXLS.Columns("B:B").Select
AppliXLS.ActiveWorkbook.Names.Add Name:="model", RefersToR1C1:="=VALIDATION!C2"
AppliXLS.Sheets("TABLE_TOTAL_SOFT").Select
'Ajout de la VALIDATION sur la colonne J:J
AppliXLS.Columns("J:J").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=brand"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = "Not in list"
.ShowInput = True
.ShowError = True
End With
'Ajout de la VALIDATION sur la colonne K:K
AppliXLS.Columns("K:K").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=model"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = "Not in list"
.ShowInput = True
.ShowError = True
End With
AppliXLS.Application.DisplayAlerts = False
AppliXLS.ActiveWorkbook.SaveAs Filename:=iStr_Repertoire & "toto-For creation - Soft.xls", FileFormat:=xlExcel8, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False, ConflictResolution:=True
GoTo Fin
Probleme:
MsgBox Error$
Fin:
AppliXLS.Quit
Set AppliXLS = Nothing
End Function |
Partager