Excel VBA Macro: Create Word Doc & Change Text Style (Font, Size, Bold, Italicize, Underline, Color)

  Рет қаралды 6,350

greggowaffles

greggowaffles

Жыл бұрын

Excel VBA Macro: Create Word Doc & Change Text Style (Font, Size, Bold, Italicize, Underline, Color). In this video, we go over how to create a word document, add text, and change the appearance of the text with our code.
Code:
Sub change_font()
Dim objWord
Dim objDoc
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add
With objDoc
objDoc.Styles.Add ("MyFontStyle")
With .Styles("MyFontStyle").Font
.Name = "Impact"
.Size = 30
.Bold = False
.Underline = False
.Italic = True
.textColor = RGB(31, 174, 225)
End With
End With
With objWord
.Selection.Style = objDoc.Styles("MyFontStyle")
.Visible = True
.Activate
.Selection.typetext ("Hello!!!!!!!!")
.Selection.typeparagraph
.Selection.typetext (ThisWorkbook.Sheets("Whatever").Cells(1, 1).Text)
End With
End Sub
#ExcelVBA #ExcelMacro

Пікірлер: 9
@MohamedAboAbdo03
@MohamedAboAbdo03 17 күн бұрын
Thank you so much
@drewgossage8842
@drewgossage8842 Жыл бұрын
Another great upload!
@greggowaffles
@greggowaffles Жыл бұрын
Glad you enjoy it!
@jayal5550
@jayal5550 Жыл бұрын
Nice work!!!
@greggowaffles
@greggowaffles Жыл бұрын
Thank you!!
@assbr75
@assbr75 3 ай бұрын
Can this apply to another language? It is not active with Arabic. What is the solution? It means changing the font size and bold
@ambrosesabbat9385
@ambrosesabbat9385 10 ай бұрын
Nice video, how can I align the text ?
@sandeepmaheshwari1936
@sandeepmaheshwari1936 Жыл бұрын
I have a query.Can you help?
@greggowaffles
@greggowaffles Жыл бұрын
Hey. I’ll see what I can do
Free Excel VBA Course #35 - Creating Word Reports Using VBA
25:23
Always be more smart #shorts
00:32
Jin and Hattie
Рет қаралды 48 МЛН
I wish I could change THIS fast! 🤣
00:33
America's Got Talent
Рет қаралды 123 МЛН
Did you believe it was real? #tiktok
00:25
Анастасия Тарасова
Рет қаралды 52 МЛН
Unlock Excel Secrets: Magic Search Bar You NEVER Knew About!
17:59
PK: An Excel Expert
Рет қаралды 485 М.
Excel VBA - Font Color
4:55
Tutorialspoint
Рет қаралды 147 М.
Automate Word Document from Excel Using VBA
7:45
Nodes Automations
Рет қаралды 49 М.
Excel VBA Tips n Tricks #1 Bold, Underline, Italic using VBA
3:41
ExcelVbaIsFun
Рет қаралды 48 М.
VBA Code to Create & Format Charts in Excel
13:36
Chester Tugwell
Рет қаралды 56 М.
Recording Powerful Macros in Microsoft Word
8:57
Technology for Teachers and Students
Рет қаралды 38 М.
Font | Excel VBA
2:07
GoTo Excel
Рет қаралды 1,2 М.
Recording a Macro to Automate Replace Special in Microsoft Word
6:52
Everyday Office
Рет қаралды 13 М.