如何在写excel文件时动态添加一行?
如下例:
appReport = New Excel.Application()
wbkReport = appReport.Workbooks.Open(path)
wbkReport = appReport.ActiveWorkbook
wstReport = wbkReport.Sheets(1)
With wstReport
.Range(.Cells(4, 6), .Cells(4, 6)).Value = lPurPerson.Text
.Range(.Cells(4, 8), .Cells(4, 8)).Value = lPurPos.Text
.Range(.Cells(5, 6), .Cells(5, 6)).Value = ""
.Range(.Cells(6, 6), .Cells(6, 6)).Value = tPurAddr.Text
.Range(.Cells(7, 6), .Cells(7, 6)).Value = lPurTel.Text
.Range(.Cells(8, 6), .Cells(8, 6)).Value = lPurFax.Text
End With
如何新增加一行,使模板尾部的内容随添加的数据而下移?
问题点数:100、回复次数:4Top
1 楼veaven(风林火山)回复于 2003-12-03 19:55:08 得分 0
upTop
2 楼cm8983(思远)回复于 2003-12-03 20:28:56 得分 80
appReport.Range("B5").Select()
appReport.Selection.EntireRow.Insert()Top
3 楼saucer(思归)回复于 2003-12-03 20:30:17 得分 20
VB Code:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=bkcfc2%248e1%241%40news.dbase.com
wstReport.ActiveSheet.Range("A3").Select
wstReport.Selection.EntireRow.Insert()
Top
4 楼saucer(思归)回复于 2003-12-03 20:37:16 得分 0
sorry, didn't see cm8983(浪侠) 's answer, but, it should be (correcting my own mistake):
wstReport.Range("A3").Select
wstReport.Selection.EntireRow.Insert()
not appReport's RangeTop




