Skip to main content

Set-Font

Command Description

Set the style of the currently selected text in the opened Word document

Command Prototype

Word.SetFontName(objWord,sName)

Parameter Description

ParameterRequiredTypeDefaultDescription
objWordTrueexpressionobjWordWord document object
sNameTruestring"Arial"Font name

Demo

/************************************Set font************** ************************ 
Command prototype:
Word.SetFontName(objWord,sName)
Input parameters:
objWord--Word document object
sName--font name
*********************************************************************************/
Dim objWord
objWord = Word.Open('''C:\Users\Administrator\Desktop\Standardization Implementation Notes.docx''',"xw4131221","",true)\
Word.SelectRow(objWord,3,5)
Word.SetFontName(objWord,"Song font")