Creating a custom text export file (inc. header & footer) from
John,
I have 'filled in' your code to thus far:
Private Sub Test_Click()
Dim rsR As DAO.Recordset
Dim strLine As String
Dim lngFN As Long
'Create empty text file
lngFN = FreeFile()
Open "D:\Folder\Addresses.kml" For Output As #lngFN
'Output header
'NB: need to double quotes in literal strings
Print #lngFN, "?xml version="; 1#; " encoding=""UTF-8""?"
Print #lngFN, "kml xmlns=""http://earth.google.com/kml/2.0"""
'...
'Output address
Set rsR = CurrentDb.Open("Generate KML")
Print #lngFN, rsR.Fields("KML_Address")
Close rsR
'Output footer
Print #lngFN blah blah
Close #lngFN
End Sub
But I am stuck on the Header and Footer:
What do I call them?; just header.txt footer.txt. do i put the full path in?
D:\folder\header.txt
and how do i get them to insert into the 'Addresses.kml' file?
"John Nurick" wrote:
There are many ways of skinning this cat. I'd probably do something like
this (air code):
Dim rsR As DAO.Recordset
Dim strLine As String
Dim lngFN As Long
'Create empty text file
lngFN = FreeFile()
Open "D:\Folder\Addresses.kml" For Output As #lngFN
'Output header
'NB: need to double quotes in literal strings
Print #lngFN, "?xml version="1.0" encoding=""UTF-8""?"
Print #lngFN, "kml xmlns=""http://earth.google.com/kml/2.0"""
'...
'Output address
Set rsR = CurrentDB.Open("My Query")
Print #lngFN, rsR.Fields("kml Address")
Close rsR
'Output footer
Print #lngFN blah blah
Close #lngFN
On Thu, 10 May 2007 10:35:01 -0700, efandango
wrote:
I have an address query which ouputs a single field to text strings for
Google Earth .kml file format parameters.
The problem is that the .kml file requires a header and footer text to be
inserted. Does anyone know how I can pre-insert the Header and Footer into a
standard text file, and then save it with a ‘.kml’ extension, for example
‘Addresses.kml’
This is the Header:
?xml version="1.0" encoding="UTF-8"?
kml xmlns="http://earth.google.com/kml/2.0"
Document
nameAddress List/name
Folder
nameLocations/name
open1/open
Output Field: [kml Address]
This is the Footer:
/Folder
/Document
/kml
--
John Nurick [Microsoft Access MVP]
Please respond in the newsgroup and not by email.
|