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 ExpoRequete()
'ajout des données
DoCmd.TransferText acExportFixed, "formatexport", "Sites-BO-kml", "C:\Users\PLAUT\Desktop\tmp.txt", False
'impression de l'entête dans le fichier
Open "C:\Users\PLAUT\Desktop\bo.txt" For Output As #1
Print #1, "<?xml version=""1.0"" encoding=""UTF - 8""?>"
Print #1, "<kml xmlns=""http://www.opengis.net/kml/2.2>"" "
Print #1, "<Document>"
Close #1
'copie du fichier temporaire
Open "C:\Users\PLAUT\Desktop\bo.txt" For Append As #1
Open "C:\Users\PLAUT\Desktop\tmp.txt" For Input As #2
While Not EOF(2)
Line Input #2, strLigne
Print #1, strLigne
Wend
Close #1
Close #2
'ajout de fin de fichier (en fait, il n'est pas nécessaire de fermer et rouvrir le #1)
Open "C:\Users\PLAUT\Desktop\bo.txt" For Append As #1
Print #1, "</Document>"
Close #1
End Sub |
Partager