文档下载 免费文档下载
https://doc.guandang.net/
VB 操作 WORD 大全
本文档下载自文档下载网,内容可能不完整,您可以点击以下网址继续阅读或下载:
http://doc.guandang.net/be3a0a5da3682cfde4de6af9c3f6291657d885e51.html
1、对其 WORD 内容设置字体样式,以及在 WORD 中插入表格,以及表格单元格融合与填充.
Option Explicit
Private Sub Command1_Click()
Dim filename As String
CD.ShowSave
filename=CD.filename
OutWord filename
MsgBox"OK"
End Sub
Private Function OutWord(ByVal filePath As String)As Boolean
Dim newDoc As Word.Document
Set newDoc=New Word.Document
文档下载 免费文档下载
https://doc.guandang.net/
With newDoc
.Paragraphs(.Paragraphs.Count)http://doc.guandang.net="宋体"
.Paragraphs(.Paragraphs.Count).Range.Font.Size=10.5
.Paragraphs(.Paragraphs.Count).Alignment=wdAlignParagraphRight
.Content.InsertAfter"編号:"&vbCrLf
.Paragraphs(.Paragraphs.Count)http://doc.guandang.net="宋体"
.Paragraphs(.Paragraphs.Count).Range.Font.Size=26
.Paragraphs(.Paragraphs.Count).Range.Font.Bold=True
.Paragraphs(.Paragraphs.Count).Alignment=wdAlignParagraphCenter
.Content.InsertAfter vbCrLf&"XXXXXXXXX 報 告 "&vbCrLf&vbCrLf&
vbCrLf&vbCrhttp://doc.guandang.net/be3a0a5da3682cfde4de6af9c3f6291657d885e51.htm
lLf&vbCrLf
.Paragraphs(.Paragraphs.Count)http://doc.guandang.net="宋体"
.Paragraphs(.Paragraphs.Count).Range.Font.Size=15
.Paragraphs(.Paragraphs.Count).Range.Font.Bold=False
.Paragraphs(.Paragraphs.Count).Alignment=wdAlignParagraphLeft
文档下载 免费文档下载
https://doc.guandang.net/
.Content.InsertAfter"项目名称:"&vbCrLf
.Content.InsertAfter"应急类型:"&vbCrLf
.Content.InsertAfter"预警状态:正常/警界/危机"&vbCrLf
.Paragraphs(.Paragraphs.Count).Alignment=wdAlignParagraphCenter
.Tables.Add Range:=.Range(Start:=.Range.End-1,End:=.Range.End),NumRows:=1,
NumColumns:=3,DefaultTableBehavior:=wdWord9TableBehavior,
AutoFitBehavior:=wdAutoFitFixed
With.Tables(1)
If.Style"表(格子)"Then
.Style="表(格子)"
End If
.ApplyStyleHeadingRows=True
.ApplyStyleLastRow=True
.ApplyStyleFirstColumn=True
.ApplyStyleLastColumn=True
.Columns.Width=50
文档下载 免费文档下载
https://doc.guandang.net/
.http://doc.guandang.net/be3a0a5da3682cfde4de6af9c3f6291657d885e51.htmlRows.Heig
ht=20
End With
.Paragraphs(.Paragraphs.Count)http://doc.guandang.net="宋体"
.Paragraphs(.Paragraphs.Count).Range.Font.Size=15
.Paragraphs(.Paragraphs.Count).Range.Font.Bold=False
.Paragraphs(.Paragraphs.Count).Alignment=wdAlignParagraphLeft
.Content.InsertAfter"委托人:"&vbCrLf
.Content.InsertAfter"预警机构:"&vbCrLf
.Content.InsertAfter"报告负责人:"&vbCrLf
.Content.InsertAfter"时间:"&vbCrLf
.Paragraphs(.Paragraphs.Count).Alignment=wdAlignParagraphLeft
.Tables.Add Range:=.Range(Start:=.Range.End-1,End:=.Range.End),NumRows:=8,
NumColumns:=2,DefaultTableBehavior:=wdWord9TableBehavior,
AutoFitBehavior:=wdAutoFitFixed
With.Tables(2)
文档下载 免费文档下载
https://doc.guandang.net/
If.Style"表(格子)"Then
.Style="表(格子)"
End If
.ApplyStyleHeadingRows=True
.ApplyStyleLastRow=True
.ApplyStyleFirstColumn=True
.ApplyStyhttp://doc.guandang.net/be3a0a5da3682cfde4de6af9c3f6291657d885e51.htmll
eLastColumn=True
.Cell(2,1).Range.Text="项目名称"
.Range.Cells(3).Row.Cells.Merge
.Range.Cells(3).Range.Font.Size=15
.Range.Cells(3).Range.Text="信息来源/文献检索范围:"&vbCrLf&vbCrLf& vbCrLf
.Range.Cells(4).Row.Cells.Merge
.Range.Cells(4).Range.Text=" 情 况 描 述 / 检 索 结
果:"&vbCrLf&vbCrLf&vbCrLf .Range.Cells(5).Row.Cells.Merge
.Range.Cells(5).Range.Text=" 影 响 分
析:"&vbCrLf&vbCrLf&vbCrLf&vbCrLf .Range.Cells(6).Row.Cells.Merge