Word VBA教程:Visual Basic 命令对照表 I

ABCDEFGHIJKLMNOPRSTUVWY

I  
If...Then...Else If...Then...Else
Indent ActiveDocument.Paragraphs(1).TabIndent
Input Input
Input$() Input()
InputBox$() InputBox
Insert Selection.InsertAfter Text:=text

'或

Selection.TypeText Text:=text

InsertAddCaption CaptionLabels.Add
InsertAddress Application.GetAddress
InsertAnnotation ActiveDocument.Comments.Add
InsertAutoCaption Clear, ClearAll, Label, Position With AutoCaptions(name)

    .AutoInsert = True

    .CaptionLabel.Name = text

    .CaptionLabel.Position = WdCaptionPosition

End With

AutoCaptions.CancelAutoInsert

InsertAutoText Selection.Range.InsertAutoText
InsertBreak Selection.InsertBreak Type:=WdBreakType
InsertCaption Selection.InsertCaption
InsertCaptionNumbering Label, FormatNumber, ChapterNumber, Level, Separator With CaptionLabels(name)

    .ChapterStyleLevel = num

    .Separator = WdSeparatorType

    .NumberStyle = WdCaptionNumberStyle

    .IncludeChapterNumber = True

End With

InsertChart ActiveDocument.Shapes.AddOLEObject
InsertColumnBreak Selection.InsertBreak Type:=wdColumnBreak
InsertCrossReference Selection.InsertCrossReference
InsertDatabase Selection.Range.InsertDatabase
InsertDateField Selection.Fields.Add Range:=range, Type:=wdFieldDate
InsertDateTime Selection.InsertDateTime
InsertDrawing ActiveDocument.Shapes.AddOLEObject
InsertEquation ActiveDocument.Shapes.AddOLEObject
InsertExcelTable ActiveDocument.Shapes.AddOLEObject
InsertField field_type ActiveDocument.Fields.Add Range:=range, Type:=field_type
InsertFieldChars Selection.Fields.Add Range:=range, Type:=wdFieldEmpty, PreserveFormatting:=False
InsertFile Name, Range, ConfirmConversions, Link Selection.InsertFile
InsertFootnote Reference, NoteType ActiveDocument.Footnotes.Add Range:=range, Text:=text

ActiveDocument.Endnotes.Add Range:=range, Text:=text

InsertFormField Entry, Exit, Name, Enable, TextType, TextDefault, TextWidth, TextFormat, CheckSize, CheckWidth, CheckDefault, Type, OwnHelp, HelpText, OwnStat, StatText Set myField = ActiveDocument.FormFields.Add(Range:=range, Type:=WdFieldType)

With myField

    .EntryMacro = text

    .ExitMacro = text

    .Name = text

    .Enabled = True

    .OwnHelp = True

    .HelpText = text

    .OwnStatus = True

    .StatusText = text

End With

With myField.TextInput

    .Width = num

    .Default = text

    .EditType

End With

With myField.CheckBox

    .Size = num

    .AutoSize = True

    .Default = True

End With

InsertFrame Selection.Frames.Add
InsertIndex ActiveDocument.Indexes.Add
InsertMergeField ActiveDocument.MailMerge.Fields.Add
InsertObject ActiveDocument.Shapes.AddOLEObject
InsertPageBreak Selection.InsertBreak Type:=wdPageBreak
InsertPageField ActiveDocument.Fields.Add Range:=range, Type:=wdFieldPage
InsertPageNumbers ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).PageNumbers.Add
InsertPara Selection.InsertParagraphAfter

'或

Selection.TypeParagraph

InsertPicture Name, LinkToFile, New ActiveDocument.Shapes.AddPicture

ActiveDocument.InlineShapes.New Range:=range

InsertSectionBreak Selection.Range.InsertBreak Type:=WdBreakType
InsertSound Selection.InlineShapes.AddOLEObject ClassType:="SoundRec"
InsertSpike NormalTemplate.AutoTextEntries("Spike").Insert Where:=range
InsertSubdocument ActiveDocument.Subdocuments.AddFromFile Range:=range
InsertSymbol Selection.InsertSymbol
InsertTableOfAuthorities ActiveDocument.TablesOfAuthorities.Add
InsertTableOfContents ActiveDocument.TablesOfContents.Add
InsertTableOfFigures ActiveDocument.TablesOfFigures.Add
InsertTimeField ActiveDocument.Fields.Add Range:=range, Type:=wdFieldTime
InsertWordArt ActiveDocument.Shapes.AddOLEObject
InStr() InStr()
Int() Int()
IsAutoCorrectException() For Each xItem In AutoCorrect.FirstLetterExceptions

    If xItem.Name = "apt." Then isFound = True

Next xItem

For Each aItem In AutoCorrect.TwoInitialCapsExceptions

    If aItem.Name = "THem" Then aExists = True

Next aItem

IsCustomDocumentProperty() For Each aProp In ActiveDocument.CustomDocumentProperties

    If aProp.Name = "age" Then isFound = True

Next aProp

IsDocumentDirty() x = Not ActiveDocument.Saved
IsDocumentPropertyReadOnly() x =WordBasic.IsDocumentPropertyReadOnly(name)
IsExecuteOnly() x = ActiveDocument.VBProject.Protection
IsMacro() 不适用于 Word 2002
IsTemplateDirty() x = Not ActiveDocument.AttachedTemplate.Saved
Italic, Italic() Selection.Font.Italic = True

Word VBA教程

Word VBA参考教程:目录1 Word VBA参考教程:目录2
Word VBA参考教程:目录3 Word VBA参考教程:目录4
Word VBA参考教程:目录5 Word VBA参考教程:目录6
Word VBA参考教程:目录7 Word VBA参考教程:目录8
Word VBA参考教程:目录9 Word VBA参考教程:目录10
版权所有 © 中山市飞娥软件工作室 证书:粤ICP备09170368号