As previously observed I'm not much of a VBA guru.
Writing Excel macro.  
Need to create Word document and write header with auto page numbers.
(Office 365).
Research has proven unfruitful.
This is what I've come up with.
On the    .TypeText Text:="Page "    line I get "object required" for some
reason.  Can't figure out why.

    Set objHeader =
wDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range
        
    With objHeader.Select
        .TypeText Text:="Page "
        .Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="PAGE
", PreserveFormatting:=True
        .TypeText Text:=" of "
        .Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:="NUMPAGES ", PreserveFormatting:=True
        .TypeText = oText
    End With


-- 
PDML Pentax-Discuss Mail List
PDML@pdml.net
http://pdml.net/mailman/listinfo/pdml_pdml.net
to UNSUBSCRIBE from the PDML, please visit the link directly above and follow 
the directions.

Reply via email to