怎么用vba实现在word中插入excel表格
2个回答
展开全部
华为Mate50 Pro曲面旗舰手机
¥6799
苹果 AirPods Pro 2代
¥1699
索尼65英寸4K HDR专业游戏电视
¥7499
惠普战66五代15.6英寸轻薄本
¥4399
查
看
更
多
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
博思aippt
2024-07-20 广告
2024-07-20 广告
博思AIPPT是基于ai制作PPT的智能在线工具,它提供了4种AI制作PPT的方式,包括AI生成大纲、AI直接生成PPT、文本生成PPT、AI提炼word文档生成PPT,一站式集成多种AI生成PPT的方式,可满足办公用户的不同需求和使用场景...
点击进入详情页
本回答由博思aippt提供
2016-03-09 · 知道合伙人互联网行家
护肤达人IT宅族
知道合伙人互联网行家
向TA提问 私信TA
知道合伙人互联网行家
采纳数:5637
获赞数:17441
毕业于曲阜师范大学,学士学位。互联网行业2年从业经验,读过SEO相关书籍。现任爱家网SEO优化专员。
向TA提问 私信TA
关注
展开全部
Sub AA()
Dim projectno As String, projectname As String, datereceive As Date, datecomplate As Date, functionary As String
Dim arr As Object
Dim i As Long
Dim brr
projectno = ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1, 2).Range
Dim excelobject As Object
Set excelobject = GetObject("D:\Downloads\project(word)\project.xls")
Set arr = excelobject.Sheets(1).usedrange()
brr = arr
For i = 2 To UBound(brr)
If InStr(1, projectno, brr(i, 1)) > 0 Then
projectname = brr(i, 2)
datereceive = brr(i, 3)
datecomplate = brr(i, 4)
functionary = brr(i, 5)
Exit For
End If
Next i
ActiveDocument.Tables(1).Cell(1, 2).Range = projectname
ActiveDocument.Tables(1).Cell(2, 2).Range = datereceive
ActiveDocument.Tables(1).Cell(3, 2).Range = datecomplate
ActiveDocument.Tables(1).Cell(4, 2).Range = functionary
excelobject.Close False
End Sub
Dim projectno As String, projectname As String, datereceive As Date, datecomplate As Date, functionary As String
Dim arr As Object
Dim i As Long
Dim brr
projectno = ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1, 2).Range
Dim excelobject As Object
Set excelobject = GetObject("D:\Downloads\project(word)\project.xls")
Set arr = excelobject.Sheets(1).usedrange()
brr = arr
For i = 2 To UBound(brr)
If InStr(1, projectno, brr(i, 1)) > 0 Then
projectname = brr(i, 2)
datereceive = brr(i, 3)
datecomplate = brr(i, 4)
functionary = brr(i, 5)
Exit For
End If
Next i
ActiveDocument.Tables(1).Cell(1, 2).Range = projectname
ActiveDocument.Tables(1).Cell(2, 2).Range = datereceive
ActiveDocument.Tables(1).Cell(3, 2).Range = datecomplate
ActiveDocument.Tables(1).Cell(4, 2).Range = functionary
excelobject.Close False
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询