Reply
 
Thread Tools Display Modes
  #1   Report Post  
Leila
 
Posts: n/a
Default 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   Report Post  
Suzanne S. Barnhill
 
Posts: n/a
Default

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   Report Post  
Leila
 
Posts: n/a
Default

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   Report Post  
Leila
 
Posts: n/a
Default

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   Report Post  
Suzanne S. Barnhill
 
Posts: n/a
Default

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

Posting Rules

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete first page number Leila Microsoft Word Help 4 April 14th 05 07:27 PM
Page Number and Page header on the first page Frank Drost Formatting Long Documents 3 March 1st 05 02:17 PM
Possible to have incrementing number in header (not page#)? James Page Layout 1 February 9th 05 02:37 PM
Go To Page function obligates you to delete previous entry Kamran Microsoft Word Help 3 February 3rd 05 06:17 PM
FIrst page footers Noel S Pamfree Microsoft Word Help 7 December 6th 04 08:49 PM


All times are GMT +1. The time now is 01:22 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"