VB代码wordWord格式.doc

上传人:b****1 文档编号:13162565 上传时间:2022-10-07 格式:DOC 页数:10 大小:28KB
下载 相关 举报
VB代码wordWord格式.doc_第1页
第1页 / 共10页
VB代码wordWord格式.doc_第2页
第2页 / 共10页
VB代码wordWord格式.doc_第3页
第3页 / 共10页
VB代码wordWord格式.doc_第4页
第4页 / 共10页
VB代码wordWord格式.doc_第5页
第5页 / 共10页
点击查看更多>>
下载资源
资源描述

VB代码wordWord格式.doc

《VB代码wordWord格式.doc》由会员分享,可在线阅读,更多相关《VB代码wordWord格式.doc(10页珍藏版)》请在冰豆网上搜索。

VB代码wordWord格式.doc

>

0Then'

如果Word没有运行则

SetWrd=CreateObject("

运行它

EndIf

Err.Clear'

清除发生错误的Err对象

OnErrorGoTo0'

保留普通错误进程

DimdotAsString

DimdocAsString

Wrd.Visible=true

dot="

C:

\temp.dot"

doc="

c:

\temp.doc"

Documents.OpenFileName:

=dot,_

ConfirmConversions:

=False,ReadOnly:

=True,AddToRecentFiles:

=False,_

PasswordDocument:

="

"

PasswordTemplate:

Revert:

WritePasswordDocument:

WritePasswordTemplate:

Format:

=_

0

Wrd.ActiveDocument.Close

Wrd.Documents.AddTemplate:

=dot,NewTemplate:

=False

'

结果系列操作

ActiveDocument.SaveAsFileName:

=doc,FileFormat:

=wdFormatDocument,_

LockComments:

=False,Password:

AddToRecentFiles:

=True,WritePassword_

:

ReadOnlyRecommended:

=False,EmbedTrueTypeFonts:

SaveNativePictureFormat:

=False,SaveFormsData:

=False,SaveAsAOCELetter:

False

打印出来

ActiveDocument.PrintOutFileName:

=doc,Range:

=wdPrintAllDocument,Item:

wdPrintDocumentContent,Copies:

=1,Pages:

PageType:

=wdPrintAllPages,_

ManualDuplexPrint:

=False,Collate:

=True,Background:

=True,PrintToFile:

False,PrintZoomColumn:

=0,PrintZoomRow:

=0,PrintZoomPaperWidth:

=0,_

PrintZoomPaperHeight:

=0

WORD中打字

Selection.TypeTextText:

您好,先生"

如何让Word的保存命令调用我自己编写的保存方法?

在doc文档被修改以后,在退出的时候当提示用户文档已经修改,问是否保存

和直接点击保存按钮的时候,能否让Word去调用我自己编写的SaveDoc方法,

如何实现?

创建名为“FileSave”的宏,把你的代码写入在这个宏中。

当点击“保存”按钮或退出程序要求“保存”时,都会直接执行你的“FileSave”宏,而不再执行Word的内置命令。

怎么样判断Word文档中有没有图片?

Word里的图片包括两种(据我所知),楼上的漏掉了InlineShapes

IfActiveDocument.Shapes.Count+ActiveDocument.InlineShapes.Count>

0Then

MsgBox"

esit"

Else

Documentdoesn'

tcontainashape"

QQ:

怎样在程序中把图片写入到word中。

AA:

功能是:

在指定位置插入图片并设置图片的格式(包括设置为衬托于文字下    方)

Sub设置图片格式()

Selection.InlineShapes.AddPictureFileName:

D:

\Mypicture\800x600.jpg"

_

LinkToFile:

=False,SaveWithDocument:

=True

Selection.MoveLeftUnit:

=wdCharacter,Count:

=1,Extend:

=wdExtend

Selection.InlineShapes

(1).ConvertToShape.Select

Selection.ShapeRange.Fill.Visible=msoFalse

Selection.ShapeRange.Fill.Transparency=0#

Selection.ShapeRange.Line.Weight=0.75

Selection.ShapeRange.Line.DashStyle=msoLineSolid

Selection.ShapeRange.Line.Style=msoLineSingle

Selection.ShapeRange.Line.Transparency=0#

Selection.ShapeRange.Line.Visible=msoFalse

Selection.ShapeRange.LockAspectRatio=msoTrue

Selection.ShapeRange.Height=361.4

Selection.ShapeRange.Width=481.6

Selection.ShapeRange.PictureFormat.Brightness=0.5

Selection.ShapeRange.PictureFormat.Contrast=0.5

Selection.ShapeRange.PictureFormat.ColorType=msoPictureAutomatic

Selection.ShapeRange.PictureFormat.CropLeft=0#

Selection.ShapeRange.PictureFormat.CropRight=0#

Selection.ShapeRange.PictureFormat.CropTop=0#

Selection.ShapeRange.PictureFormat.CropBottom=0#

Selection.ShapeRange.RelativeHorizontalPosition=_

wdRelativeHorizontalPositionColumn

Selection.ShapeRange.RelativeVerticalPosition=_

wdRelativeVerticalPositionPage

Selection.ShapeRange.Left=wdShapeCenter

Selection.ShapeRange.Top=wdShapeCenter

Selection.ShapeRange.LockAnchor=False

Selection.ShapeRange.WrapFormat.AllowOverlap=True

Selection.ShapeRange.WrapFormat.Side=wdWrapBoth

Selection.ShapeRange.WrapFormat.DistanceTop=CentimetersToPoints(0)

Selection.ShapeRange.WrapFormat.DistanceBottom=CentimetersToPoints(0)

Selection.ShapeRange.WrapFormat.DistanceLeft=CentimetersToPoints(0.32)

Selection.ShapeRange.WrapFormat.DistanceRight=CentimetersToPoints(0.32)

Selection.ShapeRange.WrapFormat.Type=3

‘实际上真正有用的是下面的语句设置图片为衬托于文字下方

Selection.ShapeRange.ZOrdermsoSendBehindText

EndSub

有没有方法,把一个word文件,按编号返回一段一段的段落文章。

比如

1XXXX

1.1YYYY

1.1.1ZZZZ

QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ

1.1.2SSSS

PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP

能够返回一个编号对应的一个标题和一段话。

谢谢

加载MicrosoftWord9.0ObjectLibrary

DimdcAppAsWord.Application

DimdcWdAsWord.Document

PrivateSubForm_Load()

SetdcApp=NewWord.Application

SetdcWd=dcApp.Documents.Open("

\rpt.doc"

Fori=1TodcWd.Paragraphs.Count

Debug.PrintdcWd.Paragraphs(i).Range.Text

Next

dcWd.Close

SetdcWd=Nothing

dcApp.Quit

SetdcApp=Nothing

如何用vb实现在word的bookmark后插入字符

在word模版中指定了boolmark:

a,

DimwrdappAsWord.Application

DimwrddocAsWord.Document

DimstrFileNameAsString

DimiAsVariant

dimsasstring

s="

要插入的字符"

Setwrdapp=CreateObject("

strFileName=App.Path&

"

Setwrddoc=wrda

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 考试认证 > IT认证

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1