PDA

View Full Version : Solved: Extra Unwanted Page at End of Document



Zack Barresse
02-24-2005, 12:31 PM
Okay, annoying issue here. Not VBA related. I have an extra page on one of my forms (creation in-progress), it's uploaded. Can somebody take a look and tell me how to get rid of that extra page at the end? I'd really, really appreciate it. It's quite annoying. :banghead:

Anne Troy
02-24-2005, 12:45 PM
Hit Ctrl+End.
Hit Shift+Right arrow.
Type a 1 into the Font size box (don't dropdown) and hit Enter.
Voila!

Zack Barresse
02-25-2005, 03:45 PM
Okay, you're good. I knew that. But what happened with that? I mean, what did I do to not be able to just select the end (Ctrl + End) and press backspace?

Jacob Hilderbrand
02-25-2005, 03:49 PM
Sometimes that happens to me too. There isn't enough room to go to the end of the table, but the table is also too big and a second page is added.

Zack Barresse
02-25-2005, 04:08 PM
Ah, gotcha. A table thing.

Still not experienced enough with Word to feel comfortable. Just don't spend enough time with it. :(

Thanks much guys!! :)

mdmackillop
02-25-2005, 04:12 PM
I always go for the hidden font on the trailing para mark 'cos one day that little space will still go onto the next page!

Zack Barresse
02-25-2005, 04:21 PM
I always go for the hidden font on the trailing para mark 'cos one day that little space will still go onto the next page!
Huh?

mdmackillop
02-25-2005, 04:41 PM
Select the paragraph mark, Format/Font/Hidden and it goes away completely when you print or preview with format marks hidden.

Zack Barresse
02-25-2005, 04:44 PM
Okay Malcolm. I don't do Word; period. Take baby steps with me. What paragraph mark? (Found the Format --> Font --> Hidden)

mdmackillop
02-25-2005, 04:52 PM
Hi Zack,
It's the P thing that goes onto the next page. There's alway one after a table. Hidden here on your example.
Malcolm

Zack Barresse
02-25-2005, 04:54 PM
Okay, so it follows a table. Any/every table? What does it look like? How do I know it is there? Is it always hidden? Can I unhide?

Jacob Hilderbrand
02-25-2005, 05:05 PM
Tools


Options


View


Paragraph marks

mdmackillop
02-25-2005, 05:08 PM
See attached picture.

Zack Barresse
02-25-2005, 05:15 PM
Whoohoo! I see it! Word 101 !! :D

Thanks fellas! :yes

mdmackillop
02-26-2005, 05:25 AM
I knew there was a "proper" name for it, Just couldn't remember it.

From Wikipedia, the free encyclopedia.


http://upload.wikimedia.org/wikipedia/en/4/4f/Pilcrow_gentium.png (http://en.wikipedia.org/wiki/Image:Pilcrow_gentium.png)
The pilcrow (?) is what most people commonly refer to as the paragraph (http://en.wikipedia.org/wiki/Paragraph) symbol. This non-alphabetic symbol varies from typeface (http://en.wikipedia.org/wiki/Typeface) to typeface, but the form shown here is probably fairly typical.

Anne Troy
02-26-2005, 08:38 AM
What? I always called it the backwards pee. :D

TheAntiGates
02-26-2005, 02:10 PM
When I'm really squeezing to keep a page from continuing, and don't want to sacrifice text font size or margins or use other methods of conventional warfare, I will go to every linefeed between paragraphs, and incrementally lower the font on them one-by-one until paydirt. By this I mean as described above - with shift-left-arrow.

Hmmm, if this isn't born to be solved with VBA ... the key would be how to find the paragraph marks (or hard line feeds?).

Anne Troy
02-26-2005, 02:13 PM
LOL, AntiGates. If THAT's the case, you just go to Print Preview and hit the "fit to page" button.

TheAntiGates
02-26-2005, 02:15 PM
True, though doesn't the text matter font sometimes drop then?

Anne Troy
02-26-2005, 02:16 PM
Not sure. I never use it. I always do what you do. :D

mdmackillop
02-26-2005, 02:23 PM
In my exceptionally well formatted documents, I always use SpaceAfterParagraph settings (to avoid the extraneous pilcrows), which can be adjusted very simply by code.
eg

Sub PatraSpace()
Selection.WholeStory
With Selection.ParagraphFormat
If .SpaceAfter = 12 Then
.SpaceAfter = 9
Else
.SpaceAfter = 12
End If
End With
Selection.HomeKey Unit:=wdStory
End Sub

Anne Troy
02-26-2005, 02:25 PM
My, my. Perhaps we should ALL have MD exceptionally format our documents. ROFL!!

TheAntiGates
02-26-2005, 02:58 PM
Princess Anne, you are a riot!

mdmackillop
02-26-2005, 03:04 PM
Hi DB
Here's a wee (wee; Scots dialect word meaning small or to pee) routine to get rid of the EEPs.


Sub OffWithThePees()

'Thanks to brettdj for the Replace
Const FntSize = 12
MyStr = "^p"

For i = 10 To 2 Step -1
pilcrows = Replace(Space(i), " ", MyStr)
DoSpace = (i-1) * FntSize
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.ParagraphFormat
.SpaceAfter = DoSpace
End With

With Selection.Find
.Text = pilcrows
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next
End Sub

sandam
03-04-2005, 07:08 AM
you can also use the Chr function as in Chr(13) to search for hard line feeds and pillcrows. Its especially useful for cells in tables which have a hardline feed that isn't a hard line feed. I discovered this while pulling text in and out of a table and it kept adding extra lines :)

Anne Troy
03-04-2005, 07:18 AM
So, sandam. Are you saying that an "end of cell marker" is a Chr(13)? I have been looking for that information...someone wants to find the end of cell marker and insert a space in front of it. (I don't know where that question is anymore!)

sandam
03-04-2005, 07:24 AM
Yup - it was so frustrating for a while but then after a little F1 searching I found VBA has two very useful functions for string and characters Chr and Asc. I used Asc(selection.text) on a blank cell and lo and behold the returned value was 13. I have a couple of nifty procedures to manipulate strings aren't provided by VBA (or are but not to do what I want) and I'm trying to tie them up into a Kb entry (after I get back from vacation :)). Another useful tip is looking at the ascii tables provided in VBA. Especially for numbers 0-127 - i use these to search through strings when StrComp etc. just won't do. :)

And for the end of cell marker space question - try this (I know its not totally effecient but it should work.


Dim countChars as integer
Dim temp as string
Dim fRange as Range
ActiveDocument.Tables.Item(x).Cell(I,J).Select 'x = number of table in document
fRange = Selection.Range
temp = ""
For countChars = 1 to fRange.Characters.Count
If countChars = fRange.Characters.Count
temp = temp + " " + Asc(fRange.Characters.Count)
Else
temp = temp + Asc(fRange.Characters.Count)
End if
Next countChars

TonyJollans
03-04-2005, 09:01 AM
Chr(13) is a carriage return. It is not an end of cell marker.

The end of cell marker is an awkward beast. You cannot search for it, you cannot change it, you cannot, really, do much with it at all.

Try this:

In Word, type a few characters, then a paragraph mark (hit return). then insert a table and enter some text in the first couple of cells. Hit ctrl+home to go to the beginning. Ctrl+f to bring up Find - check "Use Wildcards" and look for * (or ? if you like). Now keep hitting find next and watch as it steps through the characters - it will select each one in turn, including the paragraph mark (whether or not you have them displayed), but inside the table it will skip from the last character of one cell to the first of the next without selecting the end of cell marker - it is not a proper character.

Now try this

Select a cell
Paste this code somewhere and run it
Sub seecell()
Dim ch
For Each ch In Selection.Characters
MsgBox Len(ch) & " " & Asc(ch) & " " & Asc(Right(ch, 1))
Next
End Sub
It will give you a msgbox for each character in the cell - showing 1 nn nn where 1 is the length of the character and nn is the ascii code for the character - except for the last character which is the end of cell mark, when it will show 2 13 7. The end of cell marker is a character of length 2; the first (whatever you call half a character) is chr(13) and the second is chr(7).

Just be aware of it - you can't do anything about it.

sandam
03-04-2005, 09:23 AM
true, it is a tricky one - however,and i know this is strange - by using the selection object I could overcome the end of cell marker. It might be because I'm using 2003, it might not. It was the carriage return that was playing havoc with my formatting so thats why that was the specific one I was searching for. When I pasted the cell contents into a listbox it displayed a pillcrow along with the text I selected. Maar ja ek verstaan wat jy se. dis a gevaarlikke ding dai een.

TonyJollans
03-06-2005, 10:50 AM
Hi sandam,

Afrikaans? Ik versta, maar het is geen echte Nederlands. Interesting about pasting to a listbox - I'll have to try that.

I am using 2003 too so shouldn't see any difference and I'm not entirely sure what your code is doing, but the original question (which I did see but didn't answer and also can't remember where it was) was about using Find / Replace without VBA code - and I don't think it's possible.

fumei
03-08-2005, 10:03 AM
1. Use styles. I use a TableHolder style with a font size of 2.

2. Use styles. A intelligent, and proper use of Word will have absolutely no linefeed or paragraphs between paragraphs. Adding paragraphs (ie. using the Enter key) between text paragraphs to create space is poor design. Further, EVERY paragraph mark holds ALL possible object properties of a paragraph. That is, even the "empty" paragraph marks, put in to make space, contain every possible state of every possible property Even it is set to "False". Technically speaking that "blank" paragraph mark contains:
With Selection.Font
.Name = "Times New Roman"
.Size = 11
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorWhite
.Engrave = False
.Superscript = False
.Subscript = False
.Spacing = 1
.Scaling = 100
.Position = 3
.Kerning = 11
.Animation = wdAnimationNone
End With
With Selection.Font
.Name = "Times New Roman"
.Size = 11
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorWhite
.Engrave = False
.Superscript = False
.Subscript = False
.Spacing = 1
.Scaling = 100
.Position = 3
.Kerning = 11
.Animation = wdAnimationNone
End With
With Selection.ParagraphFormat
.LeftIndent = 0
.RightIndent = 0
.SpaceBefore = 0
.SpaceBeforeAuto = False
.SpaceAfter = 0
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceDouble
.Alignment = wdAlignParagraphLeft
.WidowControl = True
.KeepWithNext = False
.KeepTogether = False
.PageBreakBefore = False
.NoLineNumber = False
.Hyphenation = True
.FirstLineIndent = 0
.OutlineLevel = wdOutlineLevel1
.CharacterUnitLeftIndent = 0
.CharacterUnitRightIndent = 0
.CharacterUnitFirstLineIndent = 0
.LineUnitBefore = 0
.LineUnitAfter = 0
End With
End Sub

You can test this by creating a "blank" document - no text. Have one with no text, but a big whack of "empty" paragraph marks. Then one with no text, and no paragraph marks. Take a look at the file sizes. True, it does not make that much difference in small documents, but on large ones - anything over 100 pages - it does make a difference.

Word is designed to use styles. After all, ALL paragraphs have a style, whether you like it or not. It is far better to use them.