Builtin Dialogs Type parameter

J

jkorchok

Here is a little code nugget to do custom page number formatting. The
parameters .FirstPage and .Position work as expected, but the .Type
parameter (which is supposed to indicate Header or Footer placement)
is interpreted as Dialogs(wdDialogInsertPageNumbers).Type. This
returns the code for wdDialogInsertPageNumbers (294) instead of
whether the user chose Header(0) or Footer(1). There are quite a few
dialogs that use Type as a parameter. How do you access it?

Thanks!

John Korchok

Dim InsPageNums As Dialog
Set InsPageNums = Dialogs(wdDialogInsertPageNumbers)
If InsPageNums.Show = -1 Then
With InsPageNums
If .Type = 0 Then
If .FirstPage = True Then

ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage).PageNumbers.Add
PageNumberAlignment:=.Position, FirstPage:=True

ActiveDocument.Sections(4).Headers(wdHeaderFooterFirstPage).PageNumbers.Add
PageNumberAlignment:=.Position, FirstPage:=False
End If

ActiveDocument.Sections(4).Headers(wdHeaderFooterPrimary).PageNumbers.Add
PageNumberAlignment:=.Position, FirstPage:=False
End If
End With
End If
 
J

Jay Freedman

Sorry, you can't use Type as a parameter in any built-in dialog. I've
bumped my head against that one a number of times -- it's just a big
bug with no workaround. Of course, given the number of documented
parameters that don't work, and the number of dialogs that have one or
more controls without any corresponding parameter, it's amazing any of
it works...

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top