如何在word表格中填入文字?
Dim OWork As Object
Dim oDoc As Object
Set OWork = CreateObject("Word.Application")
Set oDoc = OWork.Documents
oDoc.Open (App.Path & "\test.doc")
oDoc.Tables(1).Cell(1, 1).Range.Text = "标签"
如上代码 起功能就是在表格的第一行第一列填入文字"标签"二字
结果最后一句报错 说 对象不支持该属性或方法
请问该怎么办啊
谢谢
[解决办法]
Dim OWork As ObjectDim oDoc As Object Set OWork = CreateObject("Word.Application")Set oDoc = OWork.Documents.Open("e:\test6.doc")oDoc.Tables(1).Cell(1, 1).Range.Text = "标签"
[解决办法]
按lz的修改一下
Dim OWork As Object Dim oDoc As Object Set OWork = CreateObject("Word.Application") Set oDoc = OWork.Documents.Open (App.Path & "\test.doc") oDoc.Tables(1).Cell(1, 1).Range.Text = "标签"
[解决办法]
要记着加关闭,不然很麻烦,我测试时懒就惹麻烦了
[解决办法]
oDoc.Tables(1).Cell(1, 1).SelectSelection.Text = "标签"
[解决办法]