VBExcel导入导出(原创)
导入:
>0Then
DimapppAsString
="工作薄|*.xls"
en
me<>""Then
appp=me
EndIf
=1
=1
draw=Fal
ation
ok
eet
IfDir(appp)<>""Then
SetxlApp=CreateObject("ation")
SetxlBook=(appp)
Setxlsheet=eets(1)
te
DimiAsLong
DimrowsAsLong
DimcounheadAsLong
i=1
DimstrAsString
Dimstr2AsString
str="a"
str2="a"
DoWhilestr<>""Andstr2<>""
Ifstr<>""Then
str=(i,1)
EndIf
Ifstr<>""Then
str2=(1,i)
EndIf
i=i+1
Loop
rows=i-3
=rows+1
counhead=i-2
=counhead+1
DimtestAsLong
Fortest=1Tocounhead
(0,test).Text=(1,test)
Next
DimiiAsLong
DimiiiAsLong
Forii=2Torows+1
iii=iii+1
Fortest=1Tocounhead
(iii,test).Text=(ii,test)
Next
Next
draw=True
h
EndIf
El
MsgBox("当前没有可导出数据")
EndIf
导出:
>0Then
DimapppAsString
="工作薄|*.xls"
en
me<>""Then
appp=me
EndIf
ation
ok
eet
IfDir(appp)=""Then
SetxlApp=CreateObject("ation")
auto_open(appp)
e=True
SetxlBook=(appp)
Setxlsheet=eets(1)
te
DimiAsLong
DimiiAsLong
Fori=-1
(1,i)=(0,i).Text
Next
DimiiiAsLong
DimtestAsLong
Forii=
iii=iii+1
Fortest=-1
(ii,test)=(iii,test).Text
Next
Next
El
Kill(appp)
CallNiceButton1_Click'此处用递归
EndIf
El
MsgBox("当前没有可导出数据")
EndIf
本文发布于:2023-03-15 11:45:12,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/409b1a651413f0e8e047143e7921e49a.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:excel导入.doc
本文 PDF 下载地址:excel导入.pdf
留言与评论(共有 0 条评论) |