M
Marc B.
Hi,
I work on a form in MSAccess to create KML files. I guess the following
problem is simple if u know what it is.
Can somebody help my to find out what I do wrong in my code?
I want to export data into a test.txt file. Anyway, my problem is that this
code exports the string with 2 double quotes instead of one.
here the code:
_________________________________________________________________________
Dim command As Variant
Dim strdateiname As String
command = "<?xml version=""1.0"" encoding=""UTF-8""?><kml
xmlns=""http://www.opengis.net/kml/2.2""><Document><Placemark><name>CDATA
example</name><description><![CDATA[<h1>CDATA Tags are useful!</h1><p><font
color=""red"">Text is <i>more readable</i> and <b>easier to write</b> when
you can avoid using entity
references.</font></p>]]></description><Point><coordinates>102.595626,14.996729</coordinates></Point></Placemark></Document></kml>"
strdateiname = "z:\test.TXT"
Open strdateiname For Output As #1
Write #1, command
Close #1
___________________________________________________________________________
This is the result in the test.txt file:
"<?xml version=""1.0"" encoding=""UTF-8""?><kml
xmlns=""http://www.opengis.net/kml/2.2""><Document><Placemark><name>CDATA
example</name><description><![CDATA[<h1>CDATA Tags are useful!</h1><p><font
color=""red"">Text is <i>more readable</i> and <b>easier to write</b> when
you can avoid using entity
references.</font></p>]]></description><Point><coordinates>102.595626,14.996729</coordinates></Point></Placemark></Document></kml>"
---------------------------------------------------------------------------------------
When I use this code I get an error because I only use 1 double quote:
Dim command As Variant
Dim strdateiname As String
command = "<?xml version="1.0" encoding="UTF-8"?><kml
xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><name>CDATA
example</name><description><![CDATA[<h1>CDATA Tags are useful!</h1><p><font
color="red">Text is <i>more readable</i> and <b>easier to write</b> when you
can avoid using entity
references.</font></p>]]></description><Point><coordinates>102.595626,14.996729</coordinates></Point></Placemark></Document></kml>"
strdateiname = "z:\test.TXT"
Open strdateiname For Output As #1
Write #1, command
Close #1
---------------------------------------------------------------------------------------
this is what my test.txt should contain after export:
<?xml version="1.0" encoding="UTF-8"?><kml
xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><name>CDATA
example</name><description><![CDATA[<h1>CDATA Tags are useful!</h1><p><font
color="red">Text is <i>more readable</i> and <b>easier to write</b> when you
can avoid using entity
references.</font></p>]]></description><Point><coordinates>102.595626,14.996729</coordinates></Point></Placemark></Document></kml>
I work on a form in MSAccess to create KML files. I guess the following
problem is simple if u know what it is.
Can somebody help my to find out what I do wrong in my code?
I want to export data into a test.txt file. Anyway, my problem is that this
code exports the string with 2 double quotes instead of one.
here the code:
_________________________________________________________________________
Dim command As Variant
Dim strdateiname As String
command = "<?xml version=""1.0"" encoding=""UTF-8""?><kml
xmlns=""http://www.opengis.net/kml/2.2""><Document><Placemark><name>CDATA
example</name><description><![CDATA[<h1>CDATA Tags are useful!</h1><p><font
color=""red"">Text is <i>more readable</i> and <b>easier to write</b> when
you can avoid using entity
references.</font></p>]]></description><Point><coordinates>102.595626,14.996729</coordinates></Point></Placemark></Document></kml>"
strdateiname = "z:\test.TXT"
Open strdateiname For Output As #1
Write #1, command
Close #1
___________________________________________________________________________
This is the result in the test.txt file:
"<?xml version=""1.0"" encoding=""UTF-8""?><kml
xmlns=""http://www.opengis.net/kml/2.2""><Document><Placemark><name>CDATA
example</name><description><![CDATA[<h1>CDATA Tags are useful!</h1><p><font
color=""red"">Text is <i>more readable</i> and <b>easier to write</b> when
you can avoid using entity
references.</font></p>]]></description><Point><coordinates>102.595626,14.996729</coordinates></Point></Placemark></Document></kml>"
---------------------------------------------------------------------------------------
When I use this code I get an error because I only use 1 double quote:
Dim command As Variant
Dim strdateiname As String
command = "<?xml version="1.0" encoding="UTF-8"?><kml
xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><name>CDATA
example</name><description><![CDATA[<h1>CDATA Tags are useful!</h1><p><font
color="red">Text is <i>more readable</i> and <b>easier to write</b> when you
can avoid using entity
references.</font></p>]]></description><Point><coordinates>102.595626,14.996729</coordinates></Point></Placemark></Document></kml>"
strdateiname = "z:\test.TXT"
Open strdateiname For Output As #1
Write #1, command
Close #1
---------------------------------------------------------------------------------------
this is what my test.txt should contain after export:
<?xml version="1.0" encoding="UTF-8"?><kml
xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><name>CDATA
example</name><description><![CDATA[<h1>CDATA Tags are useful!</h1><p><font
color="red">Text is <i>more readable</i> and <b>easier to write</b> when you
can avoid using entity
references.</font></p>]]></description><Point><coordinates>102.595626,14.996729</coordinates></Point></Placemark></Document></kml>