Pessoal bom dia, to tentando fazer uma pagina em HTML a partir de dados de uma tabela temporária, porem na hora de gerar o loop dos dados que necessito nao esta dando certo, sera que alguem pode dar uma olhada e dar um help,
Sub AbreGoogle(TipoServico As String)
'criada por Alexandre Neves em 2012-04-12 para wmantovani do fórum ExpertAccess
Dim start_path As String
Dim fs As Scripting.FileSystemObject, F As Scripting.TextStream
Set fs = CreateObject("Scripting.FileSystemObject")
Dim Rst As DAO.Recordset
Dim wsh As Object
Set wsh = CreateObject("wscript.shell")
start_path = wsh.SpecialFolders("Desktop") & "\"
Set wsh = Nothing
Set Rst = CurrentDb.OpenRecordset("SELECT Endereço, Latitude, Longitude, Serviço FROM [ENTRADA DE PROCESSO] WHERE Serviço='" & TipoServico & "' GROUP BY Endereço, Latitude, Longitude, Serviço")
start_path = Replace(start_path, "\\", "\") & "access.html"
Set F = fs.OpenTextFile(start_path, 2, True)
F.Write "" & vbCrLf 'Linha correta
F.Write "" & vbCrLf 'Linha correta
F.Write "" & vbCrLf 'Linha correta
F.Write "" & vbCrLf 'Linha correta
F.Write "Sistema Integado de Gestao - wmantovani@gmail.com " & vbCrLf
F.Write " " & vbCrLf
F.Write "" & vbCrLf
F.Write "" & vbCrLf
F.Write "" & vbCrLf
F.Write " var map = null;" & vbCrLf
F.Write "" & vbCrLf
F.Write " function initialize() {" & vbCrLf
F.Write " if (GBrowserIsCompatible()) {" & vbCrLf
F.Write " var map = new GMap2(document.getElementById(""mapa""));" & vbCrLf
F.Write " map.setCenter(new GLatLng(-22.31487, -49.049158), 13);" & vbCrLf
F.Write " map.enableScrollWheelZoom();" & vbCrLf
F.Write "" & vbCrLf
F.Write " var ui = new GMapUIOptions();" & vbCrLf
F.Write " ui.maptypes = {normal:true, roadmap:true, hybrid:true, physical:true, satellite:true}" & vbCrLf
F.Write " ui.zoom = {scrollwheel:true,draggable: true};" & vbCrLf
F.Write " ui.controls = {scalecontrol:true, draggable: true, smallzoomcontrol3d:true,largemapcontrol3d:false, scalecontrol:true};" & vbCrLf
F.Write " ui.keyboard = true;" & vbCrLf
F.Write " map.setUI(ui);" & vbCrLf
F.Write " map.addControl(new GMapTypeControl());//inserir tipos de mapas" & vbCrLf
F.Write " map.addControl = false" & vbCrLf
F.Write " var pontosLg = new Array();" & vbCrLf
F.Write " var pontosLt = new Array();" & vbCrLf
F.Write " var html = new Array();" & vbCrLf
F.Write " var icon = new Array();" & vbCrLf
F.Write "" & vbCrLf
'Inicio das coordenadas em loop na pagina
Do While Not Rst.EOF
If IsNull(Rst("teste")) Then
F.Write "pontosLg[i] = longitude;" & vbCrLf
F.Write "pontosLt[i] = latitude;" & vbCrLf
F.Write "html[i] = " & Chr(34) & "Ecoponto" & Chr(34) & ";" & vbCrLf
F.Write "icon[i] = new GIcon(G_DEFAULT_ICON);" & vbCrLf
F.Write "icon[i].image = " & Chr(34) & "http://static.batchgeo.com/images/icons/red_Marker.png" & Chr(34) & ";" & vbCrLf
F.Write "icon[i].shadow = " & Chr(34) & "images/icon_medico_sombra.png" & Chr(34) & ";" & vbCrLf
F.Write "icon[i].iconSize = new GSize(10, 17);" & vbCrLf
F.Write "" & vbCrLf
Else
End If
Rst.MoveNext
Loop
F.Write "for (var i = 0; i < pontosLg.length; i++) {" & vbCrLf
F.Write "map.addOverlay(criarMarca(pontosLt[i], pontosLg[i], html[i],icon[i]));" & vbCrLf
F.Write "}" & vbCrLf
F.Write "}" & vbCrLf
F.Write "}" & vbCrLf
F.Write "function criarMarca(lat, lng, html, icon){" & vbCrLf
F.Write "var point = new GLatLng(lat,lng);" & vbCrLf
F.Write "var marca = new GMarker(point,{icon:icon, draggable:false});//var marca = new GMarker(point,{icon:icon, draggable:false});" & vbCrLf
F.Write "if(html != null){" & vbCrLf
F.Write "GEvent.addListener(marca, " & Chr(34) & "click" & Chr(34) & ", function() {" & vbCrLf
F.Write "marca.openInfoWindowHtml(html);" & vbCrLf
F.Write "});" & vbCrLf
F.Write "}" & vbCrLf
F.Write "return marca;" & vbCrLf
F.Write "}" & vbCrLf
F.Write " " & vbCrLf
F.Write "" & vbCrLf
F.Write "" & vbCrLf
F.Write "
" & vbCrLf
F.Write "
F.Write "" & vbCrLf
F.Write "" & vbCrLf
F.Close
Set Rst = Nothing
Call Shell("explorer.exe " & start_path, vbNormalFocus)
End Sub
Grato
Sub AbreGoogle(TipoServico As String)
'criada por Alexandre Neves em 2012-04-12 para wmantovani do fórum ExpertAccess
Dim start_path As String
Dim fs As Scripting.FileSystemObject, F As Scripting.TextStream
Set fs = CreateObject("Scripting.FileSystemObject")
Dim Rst As DAO.Recordset
Dim wsh As Object
Set wsh = CreateObject("wscript.shell")
start_path = wsh.SpecialFolders("Desktop") & "\"
Set wsh = Nothing
Set Rst = CurrentDb.OpenRecordset("SELECT Endereço, Latitude, Longitude, Serviço FROM [ENTRADA DE PROCESSO] WHERE Serviço='" & TipoServico & "' GROUP BY Endereço, Latitude, Longitude, Serviço")
start_path = Replace(start_path, "\\", "\") & "access.html"
Set F = fs.OpenTextFile(start_path, 2, True)
F.Write "" & vbCrLf 'Linha correta
F.Write "" & vbCrLf 'Linha correta
F.Write "" & vbCrLf 'Linha correta
F.Write "" & vbCrLf 'Linha correta
F.Write "
F.Write "
F.Write "
F.Write "" & vbCrLf
F.Write "" & vbCrLf
F.Write " var map = null;" & vbCrLf
F.Write "" & vbCrLf
F.Write " function initialize() {" & vbCrLf
F.Write " if (GBrowserIsCompatible()) {" & vbCrLf
F.Write " var map = new GMap2(document.getElementById(""mapa""));" & vbCrLf
F.Write " map.setCenter(new GLatLng(-22.31487, -49.049158), 13);" & vbCrLf
F.Write " map.enableScrollWheelZoom();" & vbCrLf
F.Write "" & vbCrLf
F.Write " var ui = new GMapUIOptions();" & vbCrLf
F.Write " ui.maptypes = {normal:true, roadmap:true, hybrid:true, physical:true, satellite:true}" & vbCrLf
F.Write " ui.zoom = {scrollwheel:true,draggable: true};" & vbCrLf
F.Write " ui.controls = {scalecontrol:true, draggable: true, smallzoomcontrol3d:true,largemapcontrol3d:false, scalecontrol:true};" & vbCrLf
F.Write " ui.keyboard = true;" & vbCrLf
F.Write " map.setUI(ui);" & vbCrLf
F.Write " map.addControl(new GMapTypeControl());//inserir tipos de mapas" & vbCrLf
F.Write " map.addControl = false" & vbCrLf
F.Write " var pontosLg = new Array();" & vbCrLf
F.Write " var pontosLt = new Array();" & vbCrLf
F.Write " var html = new Array();" & vbCrLf
F.Write " var icon = new Array();" & vbCrLf
F.Write "" & vbCrLf
'Inicio das coordenadas em loop na pagina
Do While Not Rst.EOF
If IsNull(Rst("teste")) Then
F.Write "pontosLg[i] = longitude;" & vbCrLf
F.Write "pontosLt[i] = latitude;" & vbCrLf
F.Write "html[i] = " & Chr(34) & "Ecoponto" & Chr(34) & ";" & vbCrLf
F.Write "icon[i] = new GIcon(G_DEFAULT_ICON);" & vbCrLf
F.Write "icon[i].image = " & Chr(34) & "http://static.batchgeo.com/images/icons/red_Marker.png" & Chr(34) & ";" & vbCrLf
F.Write "icon[i].shadow = " & Chr(34) & "images/icon_medico_sombra.png" & Chr(34) & ";" & vbCrLf
F.Write "icon[i].iconSize = new GSize(10, 17);" & vbCrLf
F.Write "" & vbCrLf
Else
End If
Rst.MoveNext
Loop
F.Write "for (var i = 0; i < pontosLg.length; i++) {" & vbCrLf
F.Write "map.addOverlay(criarMarca(pontosLt[i], pontosLg[i], html[i],icon[i]));" & vbCrLf
F.Write "}" & vbCrLf
F.Write "}" & vbCrLf
F.Write "}" & vbCrLf
F.Write "function criarMarca(lat, lng, html, icon){" & vbCrLf
F.Write "var point = new GLatLng(lat,lng);" & vbCrLf
F.Write "var marca = new GMarker(point,{icon:icon, draggable:false});//var marca = new GMarker(point,{icon:icon, draggable:false});" & vbCrLf
F.Write "if(html != null){" & vbCrLf
F.Write "GEvent.addListener(marca, " & Chr(34) & "click" & Chr(34) & ", function() {" & vbCrLf
F.Write "marca.openInfoWindowHtml(html);" & vbCrLf
F.Write "});" & vbCrLf
F.Write "}" & vbCrLf
F.Write "return marca;" & vbCrLf
F.Write "}" & vbCrLf
F.Write "
F.Write "" & vbCrLf
F.Write "" & vbCrLf
F.Write "
F.Write "
" & vbCrLf
F.Write "
" & vbCrLfF.Write "
F.Write "" & vbCrLf
F.Write "" & vbCrLf
F.Close
Set Rst = Nothing
Call Shell("explorer.exe " & start_path, vbNormalFocus)
End Sub
Grato
- Anexos
- arquivo.zip
- Você não tem permissão para fazer download dos arquivos anexados.
- (100 Kb) Baixado 21 vez(es)