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
|
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hWnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub Seuil()
'
' Seuil Macro
'
' récupération des fichiers de données
Dim Recup
Recup = "p:\document\Scripts\Recup_sources\Recup.vbs"
ShellExecute 0, "open", Recup, "", "", 1
MsgBox "Tous les fichiers source sont récupérés"
Demander_Mois = "Saisir le numéro du mois souhaité (par exp 06)"
Mois = InputBox(Demander_Mois, "Mois")
Dim stNomFichier
stNomFichier = "Fichier.2010" & Mois & ".txt"
'Affichage temporaire pour vérifier..
MsgBox stNomFichier
ActiveWindow.Visible = False
Windows("Rapport.xlsm").Activate
Sheets("Seuil").Select
Range("A1:G5000").Select
Selection.ClearContents
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;stNomFichier" _
, Destination:=Range("$A$2"))
.Name = "Seuil"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = True
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileOtherDelimiter = "|"
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub |
Partager