VBA Word - Exemplos de Códigos - C - Em ordem alfabética.


Termo de Responsabilidade




« C »




Call, Run a Macro That's in Another Template: 

Application.Run "[TemplateName].[ModuleName].[MacroName] Example: Application.Run "Normal.NewMacros.Macro1" Example: Application.Run "Normal.Module1.Macro2"





Call, 

Run a Macro That's Within the Same Template: 
Application.Run MacroName:="[MacroName]"Caption,





Load an Array Element Into an Option Box Caption: 

opt1.Caption = arrArrayName(0)CHR (Character) Function: Here are some of the more commonly used ASCII codes: Chr(9) = tab Chr(11) = manual line break (shift-enter) Chr(12) = manual page break Chr(13) = vbCrLf (return) Chr(14) = column break Chr(30) = non-breaking hyphen Chr(31) = optional hyphen Chr(32) = space Chr(34) = quotation mark Chr(160) = nonbreaking space For more, look up ASCII character codes in the appendix of most computer books. See also "Chr$" under VBA Help. USAGE EXAMPLE: Selection.TypeText text:=Chr(11)



ComboBox, Add Array Items to Combo Box: 

For i = 1 to 18   '18 elements in array    cbxComboBoxName.AddItem arrArrayName(i) Next i



ComboBox, Set First Value to Show in Combo Box From an Array: 

cbxComboBoxName.Value = arrArrayName(0)    '[(1) if Option Base 1]



Constant, Declare a Constant: 

Const strIniFile as String = _    "C:\Temp\MyFile.txt"



Copy Entire Document: 

Selection.HomeKey Unit:=wdStory Selection.Extend



Copy: 

Selection.Copy




Reference::
Tags: Application, Automation, Macro, Microsoft, MS, Office, VBA, Word, code, bookmark, copy

Inline image 1

Nenhum comentário:

Postar um comentário

diHITT - Notícias