Results 1 to 5 of 5

Thread: Does anybody know?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    Does anybody know where I can find the object model reference for navigation around an Excel Object in VBScript?

    Reason being, I want to parse an excel file in an ASP page.

    Any help appreciated.

    tx
    dvst8
    Secret to long life:
    Keep breathing as long as possible.

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Posts
    104
    This page gives an overview of working with Excel objects.

    http://msdn.microsoft.com/library/of...97/web/004.htm


    You can also open VB and make a reference to the Excel object model. Then open the object viewer and select only the Excel library. This will display all of the objects in the Excel model.

    You can also open the Visual Basic editor in Excel and open the Visual Basic help file and it will provide info on the object model. The VB help file for Excel doesn't install by default so you may have to run your set up program again for Office 97 and choose the VB help for Excel.

    Hope this helps.

  3. #3
    Hyperactive Member
    Join Date
    May 2000
    Location
    Or
    Posts
    316
    The object model is exactly the same as in full blown VB-minus the events of course. If you need all the objects, just set a reference to the excel object in vb and then look at it in the object browser.


  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142

    Thumbs up

    great. thanks.
    Secret to long life:
    Keep breathing as long as possible.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142

    better way!

    instead of parsing the .xls file with code, i found a way to directly connect to it and treat it like a database!!
    much easier!!

    here's an example i found.
    credit to bill wilkinson.

    Code:
    <HTML><BODY>
    
    <%
    
    ' create and open the connection to the database
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Open "DRIVER=Microsoft Excel Driver (*.xls);" _
                & "DBQ=" & Server.MapPath("FoodStore.xls")
    
    Set RS = conn.Execute("Select * From [FoodStore$]")
    %>
    
    <TABLE Border=1 CellPadding=3>
    <TR>
    <% For f = 0 To RS.Fields.Count-1 %>
        <TH><% = RS.Fields(f).name %></TH>
    <% Next %>
    </TR>
    <% Do While Not RS.eof %>
        <TR>
        <% For f = 0 To RS.Fields.Count-1 %>
            <TD><% = RS.Fields(f).value %></TD>
        <% Next %>
        </TR>
        <% RS.MoveNext %>
    <% Loop %>
    </TABLE>
    
    </BODY></HTML>
    dvst8
    Secret to long life:
    Keep breathing as long as possible.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width