from VB6  write to html file with style

Posted on 2006-04-29
Last Modified: 2010-05-01
   I am developing a vb6 windows application. What I really need is to shop the content of a recorset in a browser
I have two approaches in mind
  As I loop thru the recordset , the entries in the recorset are to be written to an xml file and then applying style from an XSL style  sheet  write to an HTML file  . (I have done this in

As I loop thru the recorset, the entries are directly written to the html file applying style from a CSS file

In anycase my idea is to show the contents of recordset on an html file applying a style.

 Can you help me?

Question by:sgs1970
    LVL 1

    Accepted Solution

    Dim fso, F
        Set fso = CreateObject("Scripting.FileSystemObject")
        fname = App.Path & "\" & "ds.html"
        Set F = fso.OpenTextFile(fname, 2, True)
        F.writeline "<HTML>"
        F.writeline "<BODY>"
        F.writeline "<FONT size=2 face=Arial>"
        F.writeline "<center><h2>SALE REPORT AS ON " & DTS.value & "</h2></CENTER>"
        F.writeline "<table width=100% border=1 cellspacing=0 cellpadding=0>"
        F.writeline "<caption><B><FONT size=3 face=Arial BLACK>Sale:</FONT></B></caption>"
        F.writeline "<tr align=center>"
        F.writeline "<td>Product Name</td>"
        F.writeline "<td>Opening</td>"
        F.writeline "<td>Purchase</td>"
        F.writeline "<td>Rate</td>"
        F.writeline "<td>Sale</td>"
        F.writeline "<td>Rate</td>"
        F.writeline "<td>Closing</td>"
        F.writeline "<td>Sale Amount</td>"
        Set RS = New ADODB.Recordset
        RS.Open "SELECT * FROM STOCK ORDER BY DATE", CN, adOpenStatic, adLockOptimistic
    While Not RS.EOF
            F.writeline "<tr>"
            F.writeline "<td>" & RS("PRODUCT") & "</td>"
            F.writeline "<td>" & RS("OQTY") & "</td>"
            F.writeline "<td>" & RS("PQTY") & "</td>"
            F.writeline "<td>" & RS("PRATE") & "</td>"
            F.writeline "<td>" & RS("SQTY") & "</td>"
            F.writeline "<td>" & RS("SRATE") & "</td>"
            F.writeline "<td>" & RS("CQTY") & "</td>"
            F.writeline "<td>" & RS("SAMOUNT") & "</td>"

    Author Comment


       Is there really a way to have an XSL or CSS file . The advantage I seek is , the style can be changed later too without the source code

       Can you help me?

    Author Comment


     Can Someone help me ?

    Author Comment


      I accept azeemdigitalsoft 's answer , eventhough it  doesn't  meet  my requirment.


    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now