Word VBA Page Numbering turns Table borders on.

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Ripperdan

Danny
Thread Starter
Joined
Oct 28, 2009
Messages
64
In Word 2002, I have quite an extensive macro that inserts text, tables and graphics. Some of the tables are supposed to have their borders turned off.

My beginning of the macro opens a new document, does the page setup and then adds page numbering.

This is the code.:

Documents.Add DocumentType:=wdNewBlankDocument

ActiveWindow.View.Type = wdPrintView

With ActiveDocument.PageSetup
.Orientation = wdOrientPortrait
.TopMargin = InchesToPoints(0.3)
.BottomMargin = InchesToPoints(0.5)
.LeftMargin = InchesToPoints(0.5)
.RightMargin = InchesToPoints(0.5)
.Gutter = InchesToPoints(0.5)
.HeaderDistance = InchesToPoints(0)
.FooterDistance = InchesToPoints(0.2)
.PageWidth = InchesToPoints(8.5)
.PageHeight = InchesToPoints(11)
.MirrorMargins = True
End With

With ActiveDocument.Sections(1)
.Footers(wdHeaderFooterPrimary).PageNumbers.Add _
PageNumberAlignment:=wdAlignPageNumberCenter, _
FirstPage:=True
End With


When I run the macro with the “ActiveDocument.Sections(1)” commented out, the tables show no borders like they are supposed to. If I Un-Comment the “ActiveDocument.Sections(1)” and run the macro, all the tables have their borders on. Anyone have an idea why?

Actually, I would like to have the Odd page numbers on the right and the Even page numbers on the left but I had some trouble getting that to work correctly so I settled for having the page numbers in the center on all pages. If you could help me with the code to get the Odd/Even page numbering to work, I’d appreciate it.
 
Joined
Jul 3, 2003
Messages
1,068
I know nothing about using Word macros so I'm sorry I can't help. But what you're doing seems an exceedingly complicated way to generate a new document. How often do you do it? Why don't you just set your document template to a layout of different odd and even page header and footer?
 

Ripperdan

Danny
Thread Starter
Joined
Oct 28, 2009
Messages
64
Thanks for responding.

The macro mentioned is stored in a database type file and the information in that database is manipulated in a couple of different ways, requiring that it opens a new document to insert the manipulated information into. This will eventually be used by a number of people who don't have a clue what a word template is or where to save it. That being the case, I have to put in the code to do the page setup. Everything works as expected except the page setup stuff.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top