Exportar resultados...
 
Notifications
Clear all

Exportar resultados do Listbox para HTML  

  RSS

willianrc
(@willianrc)
Trusted Member
Entrou: 4 anos atrás
Posts: 59
01/08/2020 6:27 pm  

Estou tentando exportar os resultados do Listbox para o arquivo HTML, mas está apenas exportando a primeira coluna, também gostaria de exportar os outros resultados do Listbox. alguém me ajuda?

Código:

Private Sub CreateHTML()

  'Create an .html file in the assigned directory.
  Dim sFile As Variant

   sFile = Application.GetSaveAsFilename(fileFilter:="HTML Files (*.html), *.htm")

  'Open up the temp HTML file and format the header.
  Open sFile For Output As #1
  Print #1, "<html>"
  Print #1, "<head>"
  Print #1, "<style type=""text/css"">"
  Print #1, "table {font-size: 16px;font-family: Optimum, Helvetica, sans-serif; border-collapse: collapse}"
  Print #1, "tr {border-bottom: thin solid #A9A9A9;}"
  Print #1, "td {padding: 4px; margin: 3px; padding-left: 20px; width: 75%; text-align: justify;}"
  Print #1, "th { background-color: #A9A9A9; color: #FFF; font-weight: bold; font-size: 28px; text-align: center;}"
  Print #1, "td:first-child { font-weight: bold; width: 25%;}"
  Print #1, "</style>"
  Print #1, "</head>"
  Print #1, "<body>"
  Print #1, "<table class=""table""><thead><tr class=""firstrow""><th colspan=""2"">RESULTS</th></tr></thead><tbody>"

 
     
     Dim i As Long
     Dim strFind As String
     For i = 0 To Me.ListBox1.ListCount - 1

        'EDIT HERE TO CHANGE IT TO YOUR LINKING
        Print #1, "<tr><td>"
        Print #1, Me.ListBox1.List(i)
        Print #1, "</td><td>"
        Print #1, "</td></tr>"
    Next i


  'Add ending HTML tags
  Print #1, "</body>"
  Print #1, "</html>"
  Close
  End Sub

ResponderCitar (Quote)
Tags do Tópico
Compartilhar: