Ik heb op MSDN de volgende code gevonden, en hij werkt, maar hoe kan ik deze ombouwen dat ik dus bijvoorbeeld allen Cel B11 op het scherm kan zetten.
Nu gedraagt de excel zich als een database, dus hij leest alles binnen!
Dit is de code:
Nu gedraagt de excel zich als een database, dus hij leest alles binnen!
Dit is de code:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
| <% Option Explicit
Dim adoCn
Dim adoRs
Dim adoFld
Dim strQuery
Dim strResults
Const adUseClient = 3
Const adClipString = 2
Const strColDelim = " </td><td>"
Const strRowDelim = "</td></tr><tr><td>"
Set adoCn = CreateObject("ADODB.Connection")
Set adoRs = CreateObject("ADODB.Recordset")
With adoCn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = _
"Data Source=e:\GTI RI\Excel\test.xls;" & "Extended Properties=Excel 8.0;"
.CursorLocation = adUseClient
.Open
End With
strQuery = "SELECT * FROM [Island$] ORDER BY Test1"
With adoRs
Set .ActiveConnection = adoCn
.Open strQuery
End With
%>
<html>
<head>
<title>Still on the Island</title>
<style>
body {font:10pt tahoma;}
table {font:10pt tahoma;}
</style>
</head>
<body>
<table cellpadding="3" cellspacing="0"
style="border:1px solid silver;">
<tr>
<td rowspan="<%= adoRs.RecordCount + 2 %>">
</td>
</tr>
<tr>
<%
For Each adoFld in adoRs.Fields
Response.Write "<td style=""border-bottom:" & "1px solid silver;""><b>" & adoFld.Name & "</b></td>"
Next
%>
</tr>
<tr>
<td>
<%
strResults = adoRs.GetString(adClipString, adoRs.RecordCount, strColDelim, strRowDelim)
strResults = Left(strResults, InStrRev(strResults,"<tr><td>") - 1)
Response.Write strResults
%>
</tr>
</table>
</body>
</html> |