写入这种格式就麻烦了。
1、字符中的引号都要改成双引号
2、每行后面都要加换行符和连接符
如:
Dim a As String
a = " <?xml version=""1.0"" encoding=""UTF-8""?>" & vbcrlf & _
"<kml xmlns=""http://earth.google.com/kml/2.2"">" & vbcrlf & _
"<!-- Processed by GE-Path -->" & vbcrlf & _
"<Document>" & vbcrlf & _
"<name>New-Path</name>" & vbcrlf & _
" <open>1</open>" & vbcrlf & _
" <LookAt>" & vbcrlf & _
"<longitude>2.2</longitude>" & vbcrlf & _
"<latitude>1.11</latitude>" & vbcrlf & _
"<range>1000000</range>" & vbcrlf & _
"<tilt>0</tilt>" & vbcrlf & _
"<heading>0</heading>" & vbcrlf & _
" </LookAt>" & vbcrlf & _
" <Style id=""sgrillo1"">" & vbcrlf & _
" <IconStyle>" & vbcrlf & _
" <Icon>" & vbcrlf & _
"<href>root://icons/palette-4.png</href>" & vbcrlf & _
" <y>128</y>" & vbcrlf & _
"<w>32</w>" & vbcrlf & _
"<h>32</h>" & vbcrlf & _
"</Icon>" & vbcrlf & _
" </IconStyle>" & vbcrlf & _
"</kml> "
'……
ys.WriteAllText("C:\Documents and Settings\Administrator\桌面\wwffw.kml", a , True,Encoding.UTF8)