Excel Macro - Creating Word doc - Can't add page numbers

jovvi07

New Member
Joined
Dec 2, 2005
Messages
1
I have an excel template that I have created that will create a word document via macros and send different pieces of information to the word document depending on the options chosen. It is working well but I can't seem to add page numbers to the Word doc from the Excel macro. Help!

This is what I have to create the word doc to prepare it for data. It works but I really want to add page numbers to it.

'Create object definitions for MS Word
Set appWD = CreateObject("Word.Application")

' Tell Word to create a new document and format it
Set appWD = New Word.Application
appWD.Documents.Add
appWD.Visible = True
zzWord_Format_Portrait

Sub zzWord_Format_Portrait()
With appWD.Selection.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.Gutter = Application.InchesToPoints(0)
.HeaderDistance = Application.InchesToPoints(0.5)
.FooterDistance = Application.InchesToPoints(0.5)
.PageWidth = Application.InchesToPoints(8.5)
.PageHeight = Application.InchesToPoints(11)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
End With
End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,214,632
Messages
6,120,655
Members
448,975
Latest member
sweeberry

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top