• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 338
  • Last Modified:

Select all text in word

I need help on selecting all the text in a word document so I can change the font.  I already know how to open and close the word document, but I can't seem to select all the text and change the font of the whole document.  Help would be appreciated.
  • 2
1 Solution
I don't understand why you put this question under VB topic but anyway: go to File Menu "Edit/SelectAll". This will highlight all your text. Then change your font.

If you reject alex1234's answer, I'll post some code.  Just to clarify, are you using Visual Basic to modify the Word document or doing this within Word's VBA?
cranejAuthor Commented:
I am using Word Automation thru Visual Basic.
First of all, I'm using Word 8.0 Object Library through Visual Basic (msword8.olb).  I'm assuming you have a Word.Application and Word.Document already and that you've started Word and opened the proper document.  Here is the code to change the font:

    Dim appWord As New Word.Application
    Dim docTest As Word.Document
    Dim winTest As Word.Window
    Dim selTest As Word.Selection

    ' Start Word and Open Document
    ' (your code here)

    ' Get Document Window
    Set winTest = docTest.ActiveWindow

    ' Get Selection Object of Window
    Set selTest = winTest.Selection

    ' Selection Entire Document and change font
    selTest.Font.Name = "Arial"   ' Choose your font by name

That's all...  It helps to record macros in Word and see what happens.  Often it supplies all the parameters when you are only interested in one or two.  And Application, Document, and Window are implied usually when you look at the macros.  Oh yeah, if you are using Word 95 it is similar but slightly different.  If you need Word 95 code, I can give you that as well.

Good Luck
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now