|
写了一个小小的例子
这里我用的是 ADO来实现 的,当然也可以用 Datatable.import来实现
Const ForWriting = 2
Dim fso, f
Dim conn
Dim input
Dim filename
filename="c:\name.xls"
Set conn= createobject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source="&filename&";Extended Properties='Excel 8.0;hdr=yes'"
Set input= createobject("ADODB.Recordset")
input.Open "select * from [sheet1$] " ,conn,2,2
Dim i
While Not input.eof
i=i+1
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\testfile" &i &".html", ForWriting, True)
html="HTML"
f.Write " <HTML>" _
& "<HEAD>" _
&"<TITLE>一个简单的HTML示例</TITLE>"_
&"</HEAD>"_
&" " _
&"<BODY>"_
&"<CENTER>"_
&"<H3>欢迎光临" &input("name") &"的主页</H3>"_
&"<BR>"_
&"<HR>"_
&"<FONT SIZE=2> "_
&" 这是我第一次做主页,无论怎么样,我都会努力做好!"_
&"</FONT>"_
&"</CENTER>"_
&" </BODY>"_
&" "_
&" </HTML>"
input.MoveNext
wait(5)
Wend
input.close
Set input=nothing
Set conn=Nothing
[ 本帖最后由 edwin_chen 于 2007-1-25 08:52 编辑 ] |
|