Vertical Alignment

B

Beth W

I have written a macro for our letterhead. Everything works great except one
thing.

The first page should have the vertical alignment set to center and all
subsequent pages should be set to top. I just can't get it to work. Any
ideas?
 
J

JBNewsGroup

Hi Beth,

Put a "Next Page" section break after the last line on page 1. Put the
cursor on the first page and then using the page setup select "This Section
Only" and vertically center the page (Layout Tab).

Hope that this is what you need.

Jerry Bodoff
 
B

Beth W

My problem is that the macro creates a signature block. So the section break
would have to go before it only if there is a second page.
 
B

Beth W

Here is the code for anyone with suggestions. Thanks.

Option Explicit
Public vatty As String
Public vltroption As String
__________________________________________________
Private Sub Attorney_Click()

End Sub
__________________________________________________
Private Sub CommandButton1_Click()
vatty = ListBox1.Text
vltroption = ListBox2.Text
Me.Hide
End Sub
__________________________________________________
Private Sub UserForm_Initialize()
ListBox1.AddItem "DRR"
ListBox1.AddItem "GTK"
ListBox1.AddItem "HSN"
ListBox1.AddItem "JSL"
ListBox1.AddItem "KEG"
ListBox1.AddItem "KRS"
ListBox1.AddItem "MAR"
ListBox1.AddItem "MBS"
ListBox1.AddItem "MJC"
ListBox1.AddItem "MRW"
ListBox1.AddItem "PWT"
ListBox1.AddItem "RHS"
ListBox1.AddItem "TDT"
ListBox1.AddItem "TMC"
ListBox1.AddItem "TPG"
ListBox1.AddItem "WMG"
ListBox1.AddItem "ET"

ListBox2.AddItem "Direct Dial"
ListBox2.AddItem "Email Address"
ListBox2.AddItem "Both"
ListBox2.AddItem "None"
End Sub
___________________________________________________
Public Sub Letter()

Dim dlg As LetterForm
vinit = 0
vname = 0
vphone = 0
vmail = 0
vsec = 0

Set dlg = New LetterForm
dlg.vatty = 0
dlg.vltroption = 0

Label1:
dlg.Show

If dlg.vatty = "KRS" Then
vinit = "KRS"
vname = "Kenneth R. S"
vphone = "(916) ###-####"
vmail = "KS@_.com"
vsec = "ca"
Else
If dlg.vatty = "TDT" Then
vinit = "TDT"
vname = "Timothy D. T"
vphone = "(916) ###-####"
vmail = "TT@_.com"
vsec = "dn"
Else
If dlg.vatty = "TMC" Then
vinit = "TMC"
vname = "Timothy M. C"
vphone = "(916) ###-####"
vmail = "TC@_.com"
vsec = "tn"
Else
If dlg.vatty = "JSL" Then
vinit = "JSL"
vname = "Joel S. L"
vphone = "(916) ###-####"
vmail = "JL@_.com"
vsec = "aw"
Else
If dlg.vatty = "RHS" Then
vinit = "RHS"
vname = "Ronald H. S"
vphone = "(916) ###-####"
vmail = "RS@_.com"
vsec = "ca"
Else
If dlg.vatty = "HSN" Then
vinit = "HSN"
vname = "Howard S. N"
vphone = "(916) ###-####"
vmail = "HN@_.com"
vsec = "rs"
Else
If dlg.vatty = "MBS" Then
vinit = "MBS"
vname = "Martin B. S"
vphone = "(916) ###-####"
vmail = "MS@_.com"
vsec = "sg"
Else
If dlg.vatty = "KEG" Then
vinit = "KEG"
vname = "Kirk E. G"
vphone = "(916) ###-####"
vmail = "KG@_.com"
vsec = "aw"
Else
If dlg.vatty = "MJC" Then
vinit = "MJC"
vname = "Michael J. C"
vphone = "(916) ###-####"
vmail = "MC@_.com"
vsec = "js"
Else
If dlg.vatty = "GTK" Then
vinit = "GTK"
vname = "George T. K"
vphone = "(916) ###-####"
vmail = "GK@_.com"
vsec = "tn"
Else
If dlg.vatty = "TPG" Then
vinit = "TPG"
vname = "Thomas P. G, Jr."
vphone = "(916) ###-####"
vmail = "TG@_.com"
vsec = "js"
Else
If dlg.vatty = "MRW" Then
vinit = "MRW"
vname = "Michael R. W"
vphone = "(916) ###-####"
vmail = "MW@_.com"
vsec = "rs"
Else
If dlg.vatty = "MAR" Then
vinit = "MAR"
vname = "Michael A. R"
vphone = "(916) ###-####"
vmail = "MR@_.com"
vsec = "sk"
Else
If dlg.vatty = "DRR" Then
vinit = "DRR"
vname = "David R. R"
vphone = "(916) ###-####"
vmail = "DR@_.com"
vsec = "sk"
Else
If dlg.vatty = "PWT" Then
vinit = "PWT"
vname = "Paul W. T"
vphone = "(916) ###-####"
vmail = "PT@_.com"
vsec = "ps"
Else
If dlg.vatty = "WMG" Then
vinit = "WMG"
vname = "William M. G"
vphone = "(916) ###-####"
vsign = "DN"
vsec = "dn"
Else
If dlg.vatty = "ET" Then
vinit = "ET"
vname = "Erica J. T"
vphone = "(916) ###-####"
vmail = "ET@_.com"
Else
MsgBox "Please select an attorney and option!", vbExclamation
GoTo Label1
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If

If dlg.vltroption = "Direct Dial" Then
GoTo Label2
Else
If dlg.vltroption = "Email Address" Then
GoTo Label2
Else
If dlg.vltroption = "Both" Then
GoTo Label2
Else
If dlg.vltroption = "None" Then
GoTo Label2
Else
MsgBox "Please select an attorney and option!", vbExclamation
GoTo Label1
End If
End If
End If
End If

Label2:

recfield = InputBox("Recipient's Name:")

'Main Document Setup
Selection.WholeStory
Selection.Font.Name = "Times New Roman"
Selection.Font.Size = 12
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
With ActiveDocument.Styles(wdStyleNormal).Font
If .NameFarEast = .NameAscii Then
.NameAscii = ""
End If
.NameFarEast = ""
End With
With ActiveDocument.PageSetup
.HeaderDistance = InchesToPoints(1)
.DifferentFirstPageHeaderFooter = True
.VerticalAlignment = wdAlignVerticalCenter
End With

'First Page Header
With Selection.Font
.Name = "Goudy Old Style"
.Size = 12
.SmallCaps = True
End With
Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
Selection.TypeText Text:=vname
Selection.TypeParagraph
Selection.Font.Size = 7
If dlg.vltroption = "Direct Dial" Then
Selection.TypeText Text:="Direct: " & vphone
Else
If dlg.vltroption = "Email Address" Then
Selection.TypeText Text:="Email: " & vmail
Else
If dlg.vltroption = "Both" Then
Selection.TypeText Text:="Direct: " & vphone
Selection.TypeParagraph
Selection.TypeText Text:="Email: " & vmail
Else
End If
End If
End If

'Primary Header
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True
With ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary)
.Range.WholeStory
.Range.Font.Name = "Goudy Old Style"
.Range.Font.Size = 12
.Range.InsertDateTime DateTimeFormat:="MMMM d, yyyy",
InsertAsField:= _
True, DateLanguage:=wdEnglishUS,
CalendarType:=wdCalendarWestern, _
InsertAsFullWidth:=False
.Range.InsertBefore recfield & vbCr
End With

Dim myrange As Range
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.InsertAfter
vbCr & "Page "
Set myrange = ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range
myrange.Collapse wdCollapseEnd
ActiveDocument.Fields.Add myrange, wdFieldPage

'Main Document Text & Signature Block
Selection.TypeParagraph
Selection.TypeParagraph
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.InsertDateTime DateTimeFormat:="MMMM d, yyyy", InsertAsField:= _
False, DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _
InsertAsFullWidth:=False
Selection.TypeParagraph
Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeText Text:=vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & _
vbTab & "Very truly yours,"
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeText Text:=vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & _
vbTab & "FIRM NAME"
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeText Text:=vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & _
" By"
Selection.TypeParagraph
Selection.TypeText Text:=vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & _
vbTab & vname
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeText Text:=vinit
Selection.TypeParagraph
Selection.Font.Name = "Arial Narrow"
Selection.Font.Size = 6
NormalTemplate.AutoTextEntries("Filename and path").Insert Where:= _
Selection.Range, RichText:=True

'Keep Signature Block Together
Selection.MoveUp Unit:=wdLine, Count:=9
Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine, Count:=9, Extend:=wdExtend
With Selection.ParagraphFormat
.KeepWithNext = True
.KeepTogether = True
End With

'Move to Begin Typing
Selection.MoveUp Unit:=wdLine, Count:=3

End Sub
 
J

JBNewsGroup

Hi Beth,

I have a couple of suggestions about your code which may make life simpler.
If you have a lot of selections take a look at using :

Select Case dlg.vatty
Case "KRS"
-- code --
Case "TDT"
-- code --
.....
Case Else
MsgBox "Please select an attorney and option!", vbExclamation
GoTo Label1
End Select

It makes life easier than trying to line up If's and End If's and to add to
the list.

Also for repeating characters take a look at STRING. For instance:
vbTab & vbTab & vbTab & vbTab & vbTab & vbTab could be STRING (6,vbTab)

Looking quickly I do not see your problem. Someone else may come along and
solve it for you. If not I will look further when I get a moment.

Jerry Bodoff
 
B

Beth W

Thanks for the tips. I'm used to writing for WordPerfect and am just getting
my feet wet in Word.
 
Top