EXCEL VBA 自动在WORD文档指定位置插入图片和粘贴表格
(2010-08-13 16:18:01)
标签:
移动宽带it |
分类: 移动、宽带__博客张凯_unikran |
1
2
3
4
5
Sub Macro1()
Dim appWD As Word.Application, doc As Object
Set appWD = CreateObject("Word.Application")
appWD.Visible = True
Set appWD = GetObject(, "Word.Application")
Set doc =
GetObject("D:\ncyh\凤鸣谷风景区\河南联通驻马店分公司凤鸣谷风景区基站评估报告.doc")
appWD.Visible = True
With appWD.Selection.Find
.Text = "UNIKRANWORD文档表"
.Wrap = wdFindContinue
End With
appWD.Selection.Find.Execute
appWD.Selection.MoveRight Unit:=wdCharacter, Count:=1
appWD.Selection.TypeParagraph
appWD.Selection.MoveLeft Unit:=wdCharacter, Count:=1
appWD.Selection.PasteExcelTable False, False, False
With appWD.Selection.Find
.Text = "UNIKRAN指标1"
.Wrap = wdFindContinue
End With
appWD.Selection.Find.Execute
appWD.Selection.MoveRight Unit:=wdCharacter, Count:=1
appWD.Selection.TypeParagraph
appWD.Selection.MoveLeft Unit:=wdCharacter, Count:=1
appWD.Selection.PasteExcelTable False, False, False
Windows("指标.xls").Activate
With appWD.Selection.Find
.Text = "UNIKRAN指标2"
.Wrap = wdFindContinue
End With
appWD.Selection.Find.Execute
appWD.Selection.MoveRight Unit:=wdCharacter, Count:=1
appWD.Selection.TypeParagraph
appWD.Selection.MoveLeft Unit:=wdCharacter, Count:=1
appWD.Selection.PasteExcelTable False, False, False
With appWD.Selection.Find
.Text = "UNIKRANFG"
.Wrap = wdFindContinue
End With
appWD.Selection.Find.Execute
appWD.Selection.MoveRight Unit:=wdCharacter, Count:=1
appWD.Selection.TypeParagraph
appWD.Selection.MoveLeft Unit:=wdCharacter, Count:=1
'appWD.Selection.PasteExcelTable False, False, False
.Text = "UNIKRANRL"
.Wrap = wdFindContinue
End With
appWD.Selection.Find.Execute
appWD.Selection.MoveRight Unit:=wdCharacter, Count:=1
appWD.Selection.TypeParagraph
appWD.Selection.MoveLeft Unit:=wdCharacter, Count:=1
'appWD.Selection.PasteExcelTable False, False, False
.Text = "UNIKRANBCCH"
.Wrap = wdFindContinue
End With
appWD.Selection.Find.Execute
appWD.Selection.MoveRight Unit:=wdCharacter, Count:=1
appWD.Selection.TypeParagraph
appWD.Selection.MoveLeft Unit:=wdCharacter, Count:=1
'appWD.Selection.PasteExcelTable False, False, False
.Text = "UNIKRANRQ"
.Wrap = wdFindContinue
End With
appWD.Selection.Find.Execute
appWD.Selection.MoveRight Unit:=wdCharacter, Count:=1
appWD.Selection.TypeParagraph
appWD.Selection.MoveLeft Unit:=wdCharacter, Count:=1
'appWD.Selection.PasteExcelTable False, False, False
.Text = "UNIKRANRLL"
.Wrap = wdFindContinue
End With
appWD.Selection.Find.Execute
appWD.Selection.MoveRight Unit:=wdCharacter, Count:=1
appWD.Selection.TypeParagraph
appWD.Selection.MoveLeft Unit:=wdCharacter, Count:=1
'appWD.Selection.PasteExcelTable False, False, False
.Text = "UNIKRANRQQ"
.Wrap = wdFindContinue
End With
appWD.Selection.Find.Execute
appWD.Selection.MoveRight Unit:=wdCharacter, Count:=1
appWD.Selection.TypeParagraph
appWD.Selection.MoveLeft Unit:=wdCharacter, Count:=1
'appWD.Selection.PasteExcelTable False, False, False
appWD.Selection.Find.ClearFormatting