Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2005

Tip: Looking for answers? Try searching our database.

Select whole document, change font

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
achidsey - 10 Nov 2005 14:21 GMT
Word Experts,

I am new to Word programming and I just need to write a few procedures to
open a document, change the font style and size, and print it.

Using the macro recorder, I was able to make it work for one document, but I
don't know the command to select the whole document so that I can then change
the font.  My code is below.

Sub PrintIncsum()

   Documents.Open FileName:="T:\Statements\SLK Emails\Daily\is.txt"

   Selection.MoveDown Unit:=wdLine, Count:=100, Extend:=wdExtend
   
   With Selection
       .Font.Size = 7
       .Font.Name = "PrestigeFixed"
   End With
   
   Application.PrintOut FileName:=""
   
End Sub

What I need help with is how to replace
    Selection.MoveDown Unit:=wdLine, Count:=100, Extend:=wdExtend
with code that will select the whole document, regardless of length.

What code will do this?

Thanks in advance,
Alan

Signature

achidsey

Helmut Weber - 10 Nov 2005 15:55 GMT
Hi,

Selection.wholestory

if there aren't any headers or footers or
other storyranges apart from the mainstory,
which doesn't seem to be the case with "is.txt".

Still better would be, not to use selection at all, like

With ActiveDocument.Range
  .Font.Name = "Arial"
End With

Signature

Gruß

Helmut Weber, MVP WordVBA

"red.sys" & chr$(64) & "t-online.de"
Win XP, Office 2003

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.