Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MS Word and pagenumbers

Posted on 2003-11-25
18
Medium Priority
?
392 Views
Last Modified: 2012-06-21
Hi,

I need to insert a page number left centered into the header that appears such as this:

Martens 1

and on page two it would appear as

Martens 2

and I am going mad trying to find a result.

Thank you all for your help!!
0
Comment
Question by:scorpion53061
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 8
18 Comments
 

Author Comment

by:scorpion53061
ID: 9817234
Problem solved by using Macro Recorder........please cancel and refund.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9817730
Please post a comment in Community Support to have this question deleted and points refunded.
0
 

Author Comment

by:scorpion53061
ID: 9817854
Learned One!!

I was wrong.....

This did everything I wanted it to do except it left 2 spaces between the page number and "Martens" i.e. "Martens  1" instead of "Martens 1"

What did I do wrong??

If oDoc.ActiveWindow.View.SplitSpecial <> CInt(Word.WdSpecialPane.wdPaneNone) Then
                oDoc.ActiveWindow.Panes(2).Close()
            End If
            If oDoc.Content.Application.ActiveWindow.ActivePane.View.Type = CInt(Word.WdViewType.wdNormalView Or oDoc.ActiveWindow. _
                            ActivePane.View.Type = CInt(Word.WdViewType.wdOutlineView)) Then
                oDoc.ActiveWindow.ActivePane.View.Type = CInt(Word.WdViewType.wdPrintView)
            End If
            oDoc.Content.Application.ActiveWindow.ActivePane.View.SeekView = CInt(Word.WdSeekView.wdSeekCurrentPageHeader)
            oDoc.Content.Application.Selection.ParagraphFormat.Alignment = CInt(Word.WdParagraphAlignment.wdAlignParagraphLeft)
            With oDoc.Content.Application.Selection.HeaderFooter.PageNumbers
                .NumberStyle = CInt(Word.WdPageNumberStyle.wdPageNumberStyleArabic)
                .HeadingLevelForChapter = 0
                .IncludeChapterNumber = False
                .ChapterPageSeparator = CInt(Word.WdSeparatorType.wdSeparatorHyphen)
                .RestartNumberingAtSection = False
                .StartingNumber = 0
            End With
            oDoc.Content.Application.Selection.HeaderFooter.PageNumbers.Add(PageNumberAlignment:= _
                    CInt(Word.WdParagraphAlignment.wdAlignParagraphRight), FirstPage:=True)
            oDoc.Content.Application.Selection.ParagraphFormat.Alignment = CInt(Word.WdParagraphAlignment.wdAlignParagraphRight)
            oDoc.Content.Application.Selection.TypeText(Text:="Martens")
            oDoc.Content.Application.ActiveWindow.ActivePane.View.SeekView = CInt(Word.WdSeekView.wdSeekMainDocument)
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 9817876
On the line where the page numbers are, what are the tabs like?  Is this spacing because of spaces or tabs?
0
 

Author Comment

by:scorpion53061
ID: 9818459
it is where when I insertd the page number that it put it and I aligned it right..........it automatically put hte page number there.


oDoc.Content.Application.Selection.HeaderFooter.PageNumbers.Add(PageNumberAlignment:= _
                    CInt(Word.WdParagraphAlignment.wdAlignParagraphRight), FirstPage:=True)
            oDoc.Content.Application.Selection.ParagraphFormat.Alignment = CInt(Word.WdParagraphAlignment.wdAlignParagraphRight)
            oDoc.Content.Application.Selection.TypeText(Text:="Martens")
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9818474
I can't quite tell, but is there a space after Martens in TypeText?
0
 

Author Comment

by:scorpion53061
ID: 9818496
no
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9818766
Nothing is leaping off the page on this one.
0
 

Author Comment

by:scorpion53061
ID: 9818868
:(
0
 

Author Comment

by:scorpion53061
ID: 9818874
if you are stumped I will never find it :)
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9818875
I will try this with my Word XP after lunch in about an hour.  If I forget about this one, just give me a gentle nudge.
0
 

Author Comment

by:scorpion53061
ID: 9819031
I figured it out.........did you figure it out already?

(If I beat the master....... :) )
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9819287
Just got back from lunch, to see an E-Mail in my box.  I hadn't gotten to it, and now I don't think that it is important to.  I wouldn't call myself the "master", per se, but I do have enough expertise to call myself an expert.  More of these kinds of questions, and a few more years with automation, and I would say that that moniker would stick!

So, what did you find, grasshopper?
0
 

Author Comment

by:scorpion53061
ID: 9819832
LOL.........

Ok but now you have to give me your email so I can pick your brain ok? (admin@jjkoepsell.com)

The answer is (was)....

.Sub PageFormat()
        Dim oDoc As Word.Document
        <edited by request from the poster scorpion53081>
        End If
        oDoc.Content.Application.ActiveWindow.ActivePane.View.SeekView = CInt(Word.WdSeekView.wdSeekCurrentPageHeader)
        'oDoc.Content.Application.ActiveWindow.ActivePane.View.SeekView = CInt(Word.WdSeekView.wdSeekEvenPagesHeader)
        oDoc.Content.Application.Selection.ParagraphFormat.Alignment = CInt(Word.WdParagraphAlignment.wdAlignParagraphRight)
        oDoc.Content.Application.Selection.TypeText(Text:="Martens ")
        oDoc.Content.Application.Selection.Fields.Add(Range:=oDoc.Content.Application.Selection.Range, Type:=CInt(Word.WdFieldType.wdFieldEmpty), Text:="page")
        oDoc.Content.Application.ActiveWindow.ActivePane.View.SeekView = CInt(Word.WdSeekView.wdSeekMainDocument)
    End Sub

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9819848
Aaah, the old adding a field instead of adding a page number trick.  Very good grasshopper!

BTW, in this day and age of spams, no E-Mails, thank you.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9819862
You can refer back to my original post, and ask Community Support to PAQ/Refund this question, since you found the solution, and there is valuable information for those searchers out there.
0
 

Accepted Solution

by:
SpazMODic earned 0 total points
ID: 9840047
PAQed, with points refunded (500)

SpazMODic
EE Moderator
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question