zchhst
2022-06-28 11:33
采纳率: 50%
浏览 57
已结题

关于#excel#的问题,如何解决?

##需求
从excel的周月报这个工作表提取EFVY列数据到word的指定位置(见word)
word:上周工作情况的内容如何引用?
1.用质量标准管理、质量过程管理、商标监控管理、质量改进管理作为第一级标题,格式为标号+宋体5号,举例:1.质量标准管理。
2.用F列对应内容作为二级标题,如下:,格式为标号+宋体5号,举例:1.1产品规范设计。
当发现E列="质量标准管理"时,F9-F11作为此一级标题下方的二级标题;
当发现E列=“质量过程管理”时,F12-F22
作为此一级标题下方的二级标题;
当发现E列=“商标监控管理”时,F23:商标现场*标准化和F24:底单回收标准化作为此一级标题下方的二级标题
3.用V列对应内容作为三级标题,格式为宋体5号,
举例:如:“印刷纸封样已完成,台账已输出,样板下单OA审批已完成,样板制作中”
作为“产品规范设计”下面的三级标题
word:上周工作情况的内容如何引用?
1.提取Y列的内容作为三级标题,放在word的下周计划的内容里,其他的与上周工作情况相同
要达到的效果

img

数据来源excel

img

不能上传excel和word,所以我也很为难,上传了这些图片

这个是后面我写的,但是二级三级标题不能带固定的标题格式和标号
Sub 测试2()

Dim i, j
Set 连接 = CreateObject("excel.application")
Set 表格 = 连接.WorkBooks.Open("D:\桌面\测试3本")

Selection.TypeText Text:="一、上周工作情况:"
Selection.TypeParagraph
Selection.TypeText Text:="1.质量标准管理"
Selection.TypeParagraph

For i = 6 To 30
For j = 6 To 23 Step 16
If 表格.worksheets(1).Cells(i, 5) = "质量标准管理" Then
表格.worksheets(1).Cells(i, j).Copy
Word.Application.Selection.PasteAndFormat (wdFormatPlainText)
Word.Application.Selection.TypeParagraph
End If
Next
Next

Selection.TypeText Text:="2.质量过程管理"
Selection.TypeParagraph

For i = 6 To 30
For j = 6 To 23 Step 16
If 表格.worksheets(1).Cells(i, 5) = "质量过程管理" Then
表格.worksheets(1).Cells(i, j).Copy
Word.Application.Selection.PasteAndFormat (wdFormatPlainText)
Word.Application.Selection.TypeParagraph
End If
Next
Next

Selection.TypeText Text:="3.商标监控管理"
Selection.TypeParagraph

For i = 6 To 30
For j = 6 To 23 Step 16
If 表格.worksheets(1).Cells(i, 5) = "商标监控管理" Then
表格.worksheets(1).Cells(i, j).Copy
Word.Application.Selection.PasteAndFormat (wdFormatPlainText)
Word.Application.Selection.TypeParagraph
End If
Next
Next

Selection.TypeText Text:="4.数据采集分析运用"
Selection.TypeParagraph

For i = 6 To 30
For j = 6 To 23 Step 16
If 表格.worksheets(1).Cells(i, 5) = "数据采集分析运用" Then
表格.worksheets(1).Cells(i, j).Copy
Word.Application.Selection.PasteAndFormat (wdFormatPlainText)
Word.Application.Selection.TypeParagraph
End If
Next
Next

Selection.TypeText Text:="5.质量改进管理"
Selection.TypeParagraph

For i = 6 To 30
For j = 6 To 23 Step 16
If 表格.worksheets(1).Cells(i, 5) = "质量改进管理" Then
表格.worksheets(1).Cells(i, j).Copy
Word.Application.Selection.PasteAndFormat (wdFormatPlainText)
Word.Application.Selection.TypeParagraph
End If
Next
Next

Selection.TypeText Text:="二、数据完成情况"
Selection.TypeParagraph

Selection.TypeText Text:="品质检验情况(外观+理化)格式=检验批/总量"
Selection.TypeParagraph
Selection.TypeText Text:="①基材:"
Selection.TypeParagraph
Selection.TypeText Text:="a.外观:98.9% "
Selection.TypeParagraph
Selection.TypeText Text:="b.理化普通:月度数据"
Selection.TypeParagraph
Selection.TypeText Text:="c.理化工程:月度数据"
Selection.TypeParagraph
Selection.TypeText Text:="②地板:9/9=100%(平均抽检合格率99.6%)"
Selection.TypeParagraph
Selection.TypeText Text:="木门:2/2=100%(平均抽检合格率99.2%)"
Selection.TypeParagraph
Selection.TypeText Text:="三、本周计划"
Selection.TypeParagraph

For i = 6 To 30
For j = 6 To 25 Step 19
If 表格.worksheets(1).Cells(i, 5) = "1.质量标准管理" Then
表格.worksheets(1).Cells(i, j).Copy
Word.Application.Selection.PasteAndFormat (wdFormatPlainText)
Word.Application.Selection.TypeParagraph
End If
Next
Next

Selection.TypeText Text:="2.质量过程管理"
Selection.TypeParagraph

For i = 6 To 30
For j = 6 To 25 Step 19
If 表格.worksheets(1).Cells(i, 5) = "质量过程管理" Then
表格.worksheets(1).Cells(i, j).Copy
Word.Application.Selection.PasteAndFormat (wdFormatPlainText)
Word.Application.Selection.TypeParagraph
End If
Next
Next

Selection.TypeText Text:="3.商标监控管理"
Selection.TypeParagraph

For i = 6 To 30
For j = 6 To 25 Step 19
If 表格.worksheets(1).Cells(i, 5) = "商标监控管理" Then
表格.worksheets(1).Cells(i, j).Copy
Word.Application.Selection.PasteAndFormat (wdFormatPlainText)
Word.Application.Selection.TypeParagraph
End If
Next
Next

Selection.TypeText Text:="4.数据采集分析运用"
Selection.TypeParagraph

For i = 6 To 30
For j = 6 To 25 Step 19
If 表格.worksheets(1).Cells(i, 5) = "数据采集分析运用" Then
表格.worksheets(1).Cells(i, j).Copy
Word.Application.Selection.PasteAndFormat (wdFormatPlainText)
Word.Application.Selection.TypeParagraph
End If
Next
Next

Selection.TypeText Text:="5.质量改进管理"
Selection.TypeParagraph

For i = 6 To 30
For j = 6 To 25 Step 19
If 表格.worksheets(1).Cells(i, 5) = "质量改进管理" Then
表格.worksheets(1).Cells(i, j).Copy
Word.Application.Selection.PasteAndFormat (wdFormatPlainText)
Word.Application.Selection.TypeParagraph
End If
Next
Next

Selection.TypeText Text:="需要协调的事情"
Selection.TypeParagraph
Selection.TypeText Text:="四、暂无"
Selection.TypeParagraph

3条回答 默认 最新

相关推荐 更多相似问题