Home |
Search |
Today's Posts |
|
#1
|
|||
|
|||
How to delete page number in the header of first page?
Hi there,
Would you please let me know what I'm dong wrong in this code? I want to delete "Page {PAGE}" in the first page header if different First page option is checked off. Any help would be appreciated! ------------------------- Sub Delete1stPgNo() Dim oField As Field If ActiveDocument.PageSetup.DifferentFirstPageHeaderF ooter = True Then ActiveDocument.ActiveWindow.ActivePane.View.SeekVi ew = wdSeekFirstPageHeader Selection.Find.ClearFormatting With Selection.Find .Text = "Page" .Replacement.Text = "" End With With Selection.Range.Fields If oField.Type = wdFieldPage Then oField.Delete End If End With ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument End If End Sub |
#2
|
|||
|
|||
Without using a "Different first page" header, there is no way to omit a
page number from the first page (unless you are using Insert | Page Numbers and clear the check box for "Show number on first page," and there's no telling what kind of MS-written code is behind this feature). Actually, if this is the first page of a document and not just a section, and if the first page is numbered one, you could use a conditional field: { IF { PAGE } 1 { PAGE } } -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Leila" wrote in message news Hi there, Would you please let me know what I'm dong wrong in this code? I want to delete "Page {PAGE}" in the first page header if different First page option is checked off. Any help would be appreciated! ------------------------- Sub Delete1stPgNo() Dim oField As Field If ActiveDocument.PageSetup.DifferentFirstPageHeaderF ooter = True Then ActiveDocument.ActiveWindow.ActivePane.View.SeekVi ew = wdSeekFirstPageHeader Selection.Find.ClearFormatting With Selection.Find .Text = "Page" .Replacement.Text = "" End With With Selection.Range.Fields If oField.Type = wdFieldPage Then oField.Delete End If End With ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument End If End Sub |
#3
|
|||
|
|||
Thanks so much Suzanne, your solution worked perfectly for the problem.
Leila "Suzanne S. Barnhill" wrote: Without using a "Different first page" header, there is no way to omit a page number from the first page (unless you are using Insert | Page Numbers and clear the check box for "Show number on first page," and there's no telling what kind of MS-written code is behind this feature). Actually, if this is the first page of a document and not just a section, and if the first page is numbered one, you could use a conditional field: { IF { PAGE } 1 { PAGE } } -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Leila" wrote in message news Hi there, Would you please let me know what I'm dong wrong in this code? I want to delete "Page {PAGE}" in the first page header if different First page option is checked off. Any help would be appreciated! ------------------------- Sub Delete1stPgNo() Dim oField As Field If ActiveDocument.PageSetup.DifferentFirstPageHeaderF ooter = True Then ActiveDocument.ActiveWindow.ActivePane.View.SeekVi ew = wdSeekFirstPageHeader Selection.Find.ClearFormatting With Selection.Find .Text = "Page" .Replacement.Text = "" End With With Selection.Range.Fields If oField.Type = wdFieldPage Then oField.Delete End If End With ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument End If End Sub |
#4
|
|||
|
|||
Just one more question how can I put the text "page" in this field? may thanks
"Leila" wrote: Thanks so much Suzanne, your solution worked perfectly for the problem. Leila "Suzanne S. Barnhill" wrote: Without using a "Different first page" header, there is no way to omit a page number from the first page (unless you are using Insert | Page Numbers and clear the check box for "Show number on first page," and there's no telling what kind of MS-written code is behind this feature). Actually, if this is the first page of a document and not just a section, and if the first page is numbered one, you could use a conditional field: { IF { PAGE } 1 { PAGE } } -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Leila" wrote in message news Hi there, Would you please let me know what I'm dong wrong in this code? I want to delete "Page {PAGE}" in the first page header if different First page option is checked off. Any help would be appreciated! ------------------------- Sub Delete1stPgNo() Dim oField As Field If ActiveDocument.PageSetup.DifferentFirstPageHeaderF ooter = True Then ActiveDocument.ActiveWindow.ActivePane.View.SeekVi ew = wdSeekFirstPageHeader Selection.Find.ClearFormatting With Selection.Find .Text = "Page" .Replacement.Text = "" End With With Selection.Range.Fields If oField.Type = wdFieldPage Then oField.Delete End If End With ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument End If End Sub |
#5
|
|||
|
|||
Use this:
{ IF { PAGE } 1 "Page { PAGE }" } -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Leila" wrote in message ... Just one more question how can I put the text "page" in this field? may thanks "Leila" wrote: Thanks so much Suzanne, your solution worked perfectly for the problem. Leila "Suzanne S. Barnhill" wrote: Without using a "Different first page" header, there is no way to omit a page number from the first page (unless you are using Insert | Page Numbers and clear the check box for "Show number on first page," and there's no telling what kind of MS-written code is behind this feature). Actually, if this is the first page of a document and not just a section, and if the first page is numbered one, you could use a conditional field: { IF { PAGE } 1 { PAGE } } -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Leila" wrote in message news Hi there, Would you please let me know what I'm dong wrong in this code? I want to delete "Page {PAGE}" in the first page header if different First page option is checked off. Any help would be appreciated! ------------------------- Sub Delete1stPgNo() Dim oField As Field If ActiveDocument.PageSetup.DifferentFirstPageHeaderF ooter = True Then ActiveDocument.ActiveWindow.ActivePane.View.SeekVi ew = wdSeekFirstPageHeader Selection.Find.ClearFormatting With Selection.Find .Text = "Page" .Replacement.Text = "" End With With Selection.Range.Fields If oField.Type = wdFieldPage Then oField.Delete End If End With ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument End If End Sub |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete first page number | Microsoft Word Help | |||
Page Number and Page header on the first page | Formatting Long Documents | |||
Possible to have incrementing number in header (not page#)? | Page Layout | |||
Go To Page function obligates you to delete previous entry | Microsoft Word Help | |||
FIrst page footers | Microsoft Word Help |