As an Amazon associate we earn from qualifying purchases. Thanks for your support!                               
×

Best Blu-ray Movie Deals


Best Blu-ray Movie Deals, See All the Deals »
Top deals | New deals  
 All countries United States United Kingdom Canada Germany France Spain Italy Australia Netherlands Japan Mexico
Dan Curtis' Classic Monsters (Blu-ray)
$21.31
3 hrs ago
U-571 4K (Blu-ray)
$29.99
9 hrs ago
The Mask 4K (Blu-ray)
$35.00
1 day ago
Twin Peaks: Fire Walk with Me 4K (Blu-ray)
$34.99
5 hrs ago
Airport: The Complete Collection 4K (Blu-ray)
$67.11
22 hrs ago
Serenity 4K (Blu-ray)
$22.79
5 hrs ago
Hard Boiled 4K (Blu-ray)
$49.99
 
Shin Godzilla 4K (Blu-ray)
$34.96
 
Outland 4K (Blu-ray)
$31.32
1 day ago
In the Mouth of Madness 4K (Blu-ray)
$36.69
 
Halloween III: Season of the Witch 4K (Blu-ray)
$14.37
1 day ago
The Sound of Music 4K (Blu-ray)
$37.99
 
What's your next favorite movie?
Join our movie community to find out


Image from: Life of Pi (2012)

Go Back   Blu-ray Forum > Entertainment > General Chat
Register FAQ Community Calendar Today's Posts Search


Reply
 
Thread Tools Display Modes
Old 07-24-2013, 02:38 PM   #1
kpkelley kpkelley is offline
Blu-ray Ninja
 
kpkelley's Avatar
 
Aug 2007
Framingham, MA
385
2478
113
152
Default Word Macro Help

Hi,

I have some reports that are saved as text files and need to be formatted before I can print them. I have been able to record a macro that will format the whole file correctly with one exception. The Page Breaks are off. I can write a macro that will insert page breaks where I need them, but I don't know how to repeat it and then end the loop at the end of the document.

Here is what I have so far:
Quote:
Sub PageBreak()
'
' PageBreak Macro
'
'
Selection.find.ClearFormatting
With Selection.find
.Text = "run date"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do
Selection.find.Execute
Selection.find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.InsertBreak Type:=wdPageBreak
Loop
End Sub
TIA,

Kyle.
  Reply With Quote
Old 07-26-2013, 02:56 PM   #2
kpkelley kpkelley is offline
Blu-ray Ninja
 
kpkelley's Avatar
 
Aug 2007
Framingham, MA
385
2478
113
152
Default

I added the following line to get it to stop at the final page...

Quote:
Do Until Selection.Information(wdActiveEndPageNumber) = ActiveDocument.Content.Information(wdActiveEndAdju stedPageNumber)
  Reply With Quote
Reply
Go Back   Blu-ray Forum > Entertainment > General Chat



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:16 AM.