Hi,

I am using MS Word 97. I have approx 100 files in the following directory
"\NR6 Draft . rpt" which are unformatted text files.I have the start of some
programming which should open each file in turn and perform identical
formatting in each file as follows:-


Sub RunNR6()

Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document

PathToUse = "\\FINPC13\SHARE FIN01\NR6 Draft .rpt\"

myFile = Dir$(PathToUse & "*.rpt")

While myFile <> ""

Set myDoc = Documents.Open(PathToUse & myFile)

Selection.WholeStory
Selection.Font.Size = 8
With ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientLandscape
.TopMargin = InchesToPoints(0.5)
.BottomMargin = InchesToPoints(0.5)
.LeftMargin = InchesToPoints(1)
.RightMargin = InchesToPoints(0.5)
.Gutter = InchesToPoints(0)
.HeaderDistance = InchesToPoints(0.5)
.FooterDistance = InchesToPoints(0.5)
.PageWidth = InchesToPoints(11.69)
.PageHeight = InchesToPoints(8.27)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
End With

On completion of the formatting above I would like help with the programming
which then:-

saves the active document as a fully formatted word document in the same
directory "\\FINPC13\SHARE FIN01\NR6 Draft .rpt\" before repeating the
procedure with the next "text" file in the directory.


Help gratefully appreciated.
Graham

Re: Programming Query Re Document Save by Word

Word
Thu Jul 21 19:36:19 CDT 2005

G'day "Graham L" <Graham L@discussions.microsoft.com>,

Add a

ActiveDocument.Save
MyFile = Dir$
Wend

to the end

as the suggested save name is the same as the open name. Save as some
parms to tweak if you have to.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


"Graham L" <Graham L@discussions.microsoft.com> reckoned:

>Hi,
>
>I am using MS Word 97. I have approx 100 files in the following directory
>"\NR6 Draft . rpt" which are unformatted text files.I have the start of some
>programming which should open each file in turn and perform identical
>formatting in each file as follows:-
>
>
>Sub RunNR6()
>
>Dim myFile As String
>Dim PathToUse As String
>Dim myDoc As Document
>
>PathToUse = "\\FINPC13\SHARE FIN01\NR6 Draft .rpt\"
>
>myFile = Dir$(PathToUse & "*.rpt")
>
>While myFile <> ""
>
>Set myDoc = Documents.Open(PathToUse & myFile)
>
> Selection.WholeStory
> Selection.Font.Size = 8
> With ActiveDocument.PageSetup
> .LineNumbering.Active = False
> .Orientation = wdOrientLandscape
> .TopMargin = InchesToPoints(0.5)
> .BottomMargin = InchesToPoints(0.5)
> .LeftMargin = InchesToPoints(1)
> .RightMargin = InchesToPoints(0.5)
> .Gutter = InchesToPoints(0)
> .HeaderDistance = InchesToPoints(0.5)
> .FooterDistance = InchesToPoints(0.5)
> .PageWidth = InchesToPoints(11.69)
> .PageHeight = InchesToPoints(8.27)
> .FirstPageTray = wdPrinterDefaultBin
> .OtherPagesTray = wdPrinterDefaultBin
> .SectionStart = wdSectionNewPage
> .OddAndEvenPagesHeaderFooter = False
> .DifferentFirstPageHeaderFooter = False
> .VerticalAlignment = wdAlignVerticalTop
> .SuppressEndnotes = False
> .MirrorMargins = False
> End With
>
>On completion of the formatting above I would like help with the programming
>which then:-
>
>saves the active document as a fully formatted word document in the same
>directory "\\FINPC13\SHARE FIN01\NR6 Draft .rpt\" before repeating the
>procedure with the next "text" file in the directory.
>
>
>Help gratefully appreciated.
>Graham