|
各位大神们 大家好
EXCEL VBA导出数据写入WORD模板文档中的表格中
问题是FOR循环中的下面代码不起作用不知是何原因
WORD表格中光标无法定位到当前表格的行尾及换行(回车符)
光标总是定位到在表格写入的字符前面
比如(光标[size=26.6667px]OB 1080 (PO 64681) 150PCS)
望给与指点 谢谢
.Selection.EndKey Unit:=wdLine
.Selection.TypeParagraph
Dim wdcx As Object
Dim wd As Object
Set wdcx = CreateObject("word.application")
Set wd = wdcx.documents.Open(path & "\Jewellery AND HAIR delivery form template(QINGDAO).docx")
wdcx.Visible = True
With wdcx
.ActiveDocument.Tables(2).Cell(4, 2).Select
.Selection.Range.text = arr(5, 14)
.ActiveDocument.Tables(2).Cell(4, 3).Select
.Selection.Range.text = arr(5, 14)
.ActiveDocument.Tables(4).Cell(2, 2).Select
.Selection.Range.text = T & "CTN"
.ActiveDocument.Tables(4).Cell(2, 3).Select
.Selection.Range.text = arr(X - 1, 18) & "Kg" & " " & arr(X - 1, 20) & "CBM"
.ActiveDocument.Tables(5).Cell(2, 2).Select
For i = 0 To UBound(brr)
.Selection.Range.text = brr1(i) & " " & brr2(i) & "PCS"
.Selection.EndKey Unit:=wdLine
.Selection.TypeParagraph
Next i
.ActiveDocument.Tables(5).Cell(3, 2).Select
.Selection.Range.text = arr(X - 1, 7) & " " & "PCS"
End With
Service Required ( i.e Express, Economy) | | Remarks | OB 1080 (PO 64681) 150PCS | TOTAL | | |
|
|