Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Select all text in word

Posted on 1999-07-08
4
Medium Priority
?
336 Views
Last Modified: 2010-05-02
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.
0
Comment
Question by:cranej
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:alex1234
ID: 1522860
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.

0
 
LVL 2

Expert Comment

by:ryanvs
ID: 1522861
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?
0
 

Author Comment

by:cranej
ID: 1522862
I am using Word Automation thru Visual Basic.
0
 
LVL 2

Accepted Solution

by:
ryanvs earned 200 total points
ID: 1522863
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.WholeStory
    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
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question