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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
| Public Format_colonne_117(1 To 3, 1 To 33) As String
Public Nbre_colonne_format_117 As Integer
Public Nbre_ligne_fichier_source As Currency
Public Fichier_2015 As String
Sub Sauvegarde_Fermeture_Fichier(NomDuFichier)
' Windows(NomDuFichier).Activate
' ActiveWorkbook.Save
Workbooks.Save
ActiveWindow.Close
End Sub
Sub Declaration_format_117() 'Format_colonne_117, Nbre_colonne_format_117
Nbre_colonne_format_117 = 32 '32 colonnes mais tableau de 33 colonnes
Format_colonne_117(1, 1) = "Nom"
Format_colonne_117(2, 1) = "Debut"
Format_colonne_117(3, 1) = "Fin"
Format_colonne_117(1, 2) = "Classification"
Format_colonne_117(2, 2) = 1
Format_colonne_117(3, 2) = 1
Format_colonne_117(1, 3) = "GHM (Code)" '' ok
Format_colonne_117(2, 3) = 3
Format_colonne_117(3, 3) = 1
Format_colonne_117(1, 4) = "Filler"
Format_colonne_117(2, 4) = 9
Format_colonne_117(3, 4) = 1
Format_colonne_117(1, 5) = "Format_RSS" ''
Format_colonne_117(2, 5) = 10
Format_colonne_117(3, 5) = 1
Format_colonne_117(1, 6) = "Code_retour"
Format_colonne_117(2, 6) = 13
Format_colonne_117(3, 6) = 1
Format_colonne_117(1, 7) = "Finess"
Format_colonne_117(2, 7) = 16
Format_colonne_117(3, 7) = 1
Format_colonne_117(1, 8) = "Format_RUM"
Format_colonne_117(2, 8) = 25
Format_colonne_117(3, 8) = 1
Format_colonne_117(1, 9) = "Numéro de RSS" '' ok
Format_colonne_117(2, 9) = 28
Format_colonne_117(3, 9) = 1
Format_colonne_117(1, 10) = "Num_Sej"
Format_colonne_117(2, 10) = 48
Format_colonne_117(3, 10) = 1
Format_colonne_117(1, 11) = "Numéro du RUM"
Format_colonne_117(2, 11) = 68
Format_colonne_117(3, 11) = 1
Format_colonne_117(1, 12) = "Date_Naiss"
Format_colonne_117(2, 12) = 78
Format_colonne_117(3, 12) = 4
Format_colonne_117(1, 13) = "Sexe"
Format_colonne_117(2, 13) = 86
Format_colonne_117(3, 13) = 1
Format_colonne_117(1, 14) = "Unité médicale (Code)" '' ok
Format_colonne_117(2, 14) = 87
Format_colonne_117(3, 14) = 1
Format_colonne_117(1, 15) = "Type_autorisation"
Format_colonne_117(2, 15) = 91
Format_colonne_117(3, 15) = 1
Format_colonne_117(1, 16) = "Date d'entrée" '' ok
Format_colonne_117(2, 16) = 93
Format_colonne_117(3, 16) = 4
Format_colonne_117(1, 17) = "Mode d'entrée (Code)" ''
Format_colonne_117(2, 17) = 101
Format_colonne_117(3, 17) = 1
Format_colonne_117(1, 18) = "Provenance" ''
Format_colonne_117(2, 18) = 102
Format_colonne_117(3, 18) = 1
Format_colonne_117(1, 19) = "Date de sortie" '' ok
Format_colonne_117(2, 19) = 103
Format_colonne_117(3, 19) = 4
Format_colonne_117(1, 20) = "Mode de sortie (Code)" ''
Format_colonne_117(2, 20) = 111
Format_colonne_117(3, 20) = 1
Format_colonne_117(1, 21) = "Destination" ''
Format_colonne_117(2, 21) = 112
Format_colonne_117(3, 21) = 1
Format_colonne_117(1, 22) = "Code_postal"
Format_colonne_117(2, 22) = 113
Format_colonne_117(3, 22) = 1
Format_colonne_117(1, 23) = "Poids_nouveau_ne"
Format_colonne_117(2, 23) = 118
Format_colonne_117(3, 23) = 1
Format_colonne_117(1, 24) = "Age_gestationnel"
Format_colonne_117(2, 24) = 122
Format_colonne_117(3, 24) = 1
Format_colonne_117(1, 25) = "Date_regle"
Format_colonne_117(2, 25) = 124
Format_colonne_117(3, 25) = 4
Format_colonne_117(1, 26) = "Nbre_seances" ''
Format_colonne_117(2, 26) = 132
Format_colonne_117(3, 26) = 1
Format_colonne_117(1, 27) = "Nbre_DAS"
Format_colonne_117(2, 27) = 134
Format_colonne_117(3, 27) = 1
Format_colonne_117(1, 28) = "Nbre_DAD"
Format_colonne_117(2, 28) = 136
Format_colonne_117(3, 28) = 1
Format_colonne_117(1, 29) = "Nbre_zone_acte"
Format_colonne_117(2, 29) = 138
Format_colonne_117(3, 29) = 1
Format_colonne_117(1, 30) = "Diagnostic principal (Code)" '' ok
Format_colonne_117(2, 30) = 141
Format_colonne_117(3, 30) = 1
Format_colonne_117(1, 31) = "DR"
Format_colonne_117(2, 31) = 149
Format_colonne_117(3, 31) = 1
Format_colonne_117(1, 32) = "IGS2"
Format_colonne_117(2, 32) = 157
Format_colonne_117(3, 32) = 1
Format_colonne_117(1, 33) = "Fin_fichier"
Format_colonne_117(2, 33) = 160
Format_colonne_117(3, 33) = 1
End Sub
Sub Calcul_NbreJourneeBrutes(Cell, NbreJourPMSI)
If NbreJourPMSI = 0 Then
Cell = 1
Else
Cell = NbreJourPMSI
End If
End Sub
Sub CodeMouvement_Libelle(cell_code, cell_libelle)
If cell_code >= 1 And cell_code <= 4 Then
cell_libelle = "Retour prestation"
ElseIf cell_code = 6 Then
cell_libelle = "Mutation"
ElseIf cell_code = 7 Then
cell_libelle = "Mutation"
ElseIf cell_code = 8 Then
cell_libelle = "Domicile"
ElseIf cell_code = 9 Then
cell_libelle = "Décès"
End If
End Sub
Sub Declaration_nbre_ligne_fichier_source() 'Nbre_ligne_fichier_source
Dim i As Long
i = 1
While Cells(i, 1).Value <> ""
i = i + 1
Wend
Nbre_ligne_fichier_source = i - 1
End Sub
Sub Convertir_GRP_format_117()
'
' Convertir_GRP_format_117 Macro
'
Dim Fichier_GRP_source As String
Dim Repertoire_fichier_GRP_source As String
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''
'' DECLARATION de variables
''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Fichier_GRP_source = Cells(1, 2).Value
Fichier_GRP_source_extension = Cells(2, 2).Value
Repertoire_fichier_GRP_source = Cells(3, 2).Value
Call Declaration_format_117 'Format_colonne_117, Nbre_colonne_format_117
Fichier_converti = Cells(6, 2).Value 'Fichier_GRP_source & "_converti" 'fichier de l'annee converti
Repertoire_fichier_converti = Cells(7, 2).Value
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''
'' CONVERTIR GRP au Format 117
''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' :=xlMSDOS, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array( _
ChDir Repertoire_fichier_GRP_source
Workbooks.OpenText Filename:= _
Repertoire_fichier_GRP_source & "\" & Fichier_GRP_source & ".txt", Origin _
:=xlMSDOS, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array( _
Array(Format_colonne_117(2, 2) - 1, Format_colonne_117(3, 2)), Array(Format_colonne_117(2, 3) - 1, Format_colonne_117(3, 3)), _
Array(Format_colonne_117(2, 4) - 1, Format_colonne_117(3, 4)), Array(Format_colonne_117(2, 5) - 1, Format_colonne_117(3, 5)), _
Array(Format_colonne_117(2, 6) - 1, Format_colonne_117(3, 6)), Array(Format_colonne_117(2, 7) - 1, Format_colonne_117(3, 7)), _
Array(Format_colonne_117(2, 8) - 1, Format_colonne_117(3, 8)), Array(Format_colonne_117(2, 9) - 1, Format_colonne_117(3, 9)), _
Array(Format_colonne_117(2, 10) - 1, Format_colonne_117(3, 10)), Array(Format_colonne_117(2, 11) - 1, Format_colonne_117(3, 11)), _
Array(Format_colonne_117(2, 12) - 1, Format_colonne_117(3, 12)), Array(Format_colonne_117(2, 13) - 1, Format_colonne_117(3, 13)), _
Array(Format_colonne_117(2, 14) - 1, Format_colonne_117(3, 14)), Array(Format_colonne_117(2, 15) - 1, Format_colonne_117(3, 15)), _
Array(Format_colonne_117(2, 16) - 1, Format_colonne_117(3, 16)), Array(Format_colonne_117(2, 17) - 1, Format_colonne_117(3, 17)), _
Array(Format_colonne_117(2, 18) - 1, Format_colonne_117(3, 18)), Array(Format_colonne_117(2, 19) - 1, Format_colonne_117(3, 19)), _
Array(Format_colonne_117(2, 20) - 1, Format_colonne_117(3, 20)), Array(Format_colonne_117(2, 21) - 1, Format_colonne_117(3, 21)), _
Array(Format_colonne_117(2, 22) - 1, Format_colonne_117(3, 22)), Array(Format_colonne_117(2, 23) - 1, Format_colonne_117(3, 23)), _
Array(Format_colonne_117(2, 24) - 1, Format_colonne_117(3, 24)), Array(Format_colonne_117(2, 25) - 1, Format_colonne_117(3, 25)), _
Array(Format_colonne_117(2, 26) - 1, Format_colonne_117(3, 26)), Array(Format_colonne_117(2, 27) - 1, Format_colonne_117(3, 27)), _
Array(Format_colonne_117(2, 28) - 1, Format_colonne_117(3, 28)), Array(Format_colonne_117(2, 29) - 1, Format_colonne_117(3, 29)), _
Array(Format_colonne_117(2, 30) - 1, Format_colonne_117(3, 30)), Array(Format_colonne_117(2, 31) - 1, Format_colonne_117(3, 31)), _
Array(Format_colonne_117(2, 32) - 1, Format_colonne_117(3, 32)), Array(Format_colonne_117(2, 33) - 1, Format_colonne_117(3, 33)) _
), TrailingMinusNumbers:=True
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''
'' CREATION du fichier
''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ActiveWorkbook.SaveAs _ Fichier_converti & ".xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.SaveAs FileFormat:=xlOpenXMLWorkbook
End Sub |
Partager