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

ABCDEFGHIJKLMNOPRSTUVWY

C  
Call Call

'或

WordBasic.Call

'或

Application.Run

Cancel Selection.ColumnSelectMode = False

Selection.ExtendMode = False

Selection.EscapeKey

CancelButton 命令按钮
CenterPara, CenterPara() Selection.Paragraphs.Alignment = wdAlignParagraphCenter

x = Selection.Paragraphs.Alignment

ChangeCase, ChangeCase() Selection.Range.Case = WdCharacterCase

x = Selection.Range.Case

CharColor, CharColor() Selection.Font.ColorIndex = WdColorIndex

x = Selection.Font.ColorIndex

CharLeft 1

CharLeft 1, 1

num = CharLeft(1)

Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdMove

Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend

num = Selection.MoveLeft(Unit:=wdCharacter, Count:=1)

CharRight 1

CharRight 1, 1

num = CharRight(1)

Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdMove

Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend

num = Selection.MoveRight(Unit:=wdCharacter, Count:=1)

ChDefaultDir path, wdDefaultFilePath Options.DefaultFilePath(WdDefaultFilePath) = path
ChDir path ChDir path

'或

Application.ChangeFileOpenDirectory

CheckBox 复选框控件
CheckBoxFormField ActiveDocument.FormFields.Add Range:=range, Type:=wdFieldFormCheckBox
ChooseButtonImage With CommandBars(name).Controls(1)

    .FaceId = num

    .TooltipText = text

End With

Chr$(num) Chr$(num)
CleanString$(string) x =CleanString(string)
ClearAddInst Addins.Unload
ClearFormField ActiveDocument.FormFields(1).TextInput.Clear
Close Close
ClosePane ActiveWindow.ActivePane.Close
ClosePreview ActiveDocument.ClosePrintPreview
CloseUpPara Selection.Paragraphs.CloseUp
CloseViewHeaderFooter ActiveWindow.View.SeekView = wdSeekMainDocument
CmpBookmarks() If ActiveDocument.Bookmarks(name) = ActiveDocument.Bookmarks(name) Then

    same = True

End If

可以用StartEnd属性来比较两个书签的起始和结束位置。

ColumnSelect Selection.ColumnSelectMode = True
ComboBox 组合框控件
CommandValid() 通过IsObjectValid属性可以判断某一对象变量引用是否有效。没有返回值的对象变量也属无效。
Connect System.Connect
ControlRun WordBasic.ControlRun

'或

Shell appfilename

Converter$(num) x = FileConverters(num).ClassName
ConverterLookup(name) x = FileConverters(name).SaveFormat
ConvertObject IconNumber, ActivateAs, IconFileName, Caption, Class, DisplayIcon With ActiveDocument.Shapes(1).OLEFormat

    .IconIndex = num

    .ActivateAs = text

    .IconPath & Application.PathSeparator & .IconName

    .IconLabel = text

    .ClassType = text

    .DisplayAsIcon = True

End With

CopyBookmark ActiveDocument.Bookmarks(name).Copy(name)
CopyButtonImage CommandBars(name).Controls(1).CopyFace
CopyFile FileCopy
CopyFormat Selection.CopyFormat
CopyText Application.Run MacroName:="CopyText"
CountAddins() x = Addins.Count
CountAutoCorrectExceptions(0)

CountAutoCorrectExceptions(1)

x = AutoCorrect.FirstLetterExceptions.Count

x = AutoCorrect.TwoInitialCapsExceptions.Count

CountAutoTextEntries() x = ActiveDocument.AttachedTemplate.AutoTextEntries.Count
CountBookmarks() x = ActiveDocument.Bookmarks.Count
CountDirectories() myPath = "C:\"

myName = Dir(myPath, vbDirectory)

Do While myName <> ""

    If myName <> "." And myName <> ".." Then

        If (GetAttr(myPath & myName) And vbDirectory) = vbDirectory Then

            count = count + 1

        End If

    End If

myName = Dir

Loop

MsgBox count & " directories"

CountDocumentProperties() x = ActiveDocument.BuiltInDocumentProperties.Count

'或

x = ActiveDocument.CustomDocumentProperties.Count

CountDocumentVars() x = ActiveDocument.Variables.Count
CountFiles() x = RecentFiles.Count
CountFonts() x = FontNames.Count

'或

x = PortraitFontNames.Count

'或

x = LandscapeFontNames.Count

CountFoundFiles() x = Application.FileSearch.FoundFiles.Count
CountKeys() CustomizationContext = template or document

x = KeyBindings.Count

CountLanguages() x = Languages.Count
CountMacros() '无直接等效项

'可统计与标准模板相关的模块数目

For Each xItem In NormalTemplate.VBProject.VBComponents

    If xItem.Type = vbext_ct_StdModule Then Count = Count + 1

Next x

MsgBox Count

CountMenuItems() x = CommandBars(name).Controls.Count
CountMenus() x = CommandBars.ActiveMenuBar.Controls.Count
CountMergeFields() x = ActiveDocument.MailMerge.Fields.Count
CountStyles() x = ActiveDocument.Styles.Count

'或

x = ActiveDocument.AttachedTemplate.OpenAsDocument.Styles.Count

'统计时排除内置样式

For Each xSty In ActiveDocument.Styles

    If xSty.BuiltIn = False Then aCount = aCount + 1

Next xSty

CountToolbarButtons() x = CommandBars(name).Controls.Count
CountToolbars() For Each xCB In CommandBars

    If xCB.Type = msoBarTypeNormal Then aCount = aCount + 1

Next xCB

CountToolsGrammarStatistics() x = ActiveDocument.Content.ReadabilityStatistics.Count
CountWindows() x = Windows.Count
CreateSubdocument ActiveDocument.Subdocuments.AddFromRange

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号