Stack Overflow Asked by Tora Garo on December 11, 2020
My goal is to create a word doc where in each letter has different fonts. Fonts will be randomly selected. Code seems working but the only problem is that I can’t get the letters append right after the previous string. It keeps making new paragraph for each letter.
wp = wd.Content.Paragraphs.Add
wp.selection.Font.Name = font
wp.selection.TypeText = letter
Here’s the result
You probably want to use the selection
property over Range
.
Try replacing
wp.Range.Font.Name = font
wp.Range.Text = letter
with
wp.Selection.font.Name = font
wp.Selection.TypeText letter
Selection
will be the current location of the cursor.
I'm not exactly sure of your intent with wp.Range.InsertParagraphAfter()
, but I don't believe it's necessary to be in the For Each . . . Next
loop.
Correct answer by K.Dᴀᴠɪs on December 11, 2020
1 Asked on August 31, 2020 by b-jarvis
2 Asked on August 30, 2020 by kay
0 Asked on August 30, 2020 by sansel
2 Asked on August 29, 2020 by artportraitdesign1
0 Asked on August 28, 2020 by prakash-kumar
2 Asked on August 28, 2020 by kim
3 Asked on August 28, 2020 by adam-sewell
1 Asked on August 28, 2020 by loopinfility
1 Asked on August 26, 2020 by philip-kearns
1 Asked on August 26, 2020 by shawn
2 Asked on August 22, 2020 by very_human
1 Asked on August 22, 2020 by sundar_ima
2 Asked on August 21, 2020 by shrinath-shankar
1 Asked on August 20, 2020 by baudoin-michael
0 Asked on August 20, 2020 by 0x5453
1 Asked on August 19, 2020 by randomthinker
11 Asked on August 19, 2020 by tams
Get help from others!
Recent Answers
Recent Questions
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP