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


Call Call





Cancel Selection.ColumnSelectMode = False

Selection.ExtendMode = False


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



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


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


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


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号