Greg Maxey was telling us:
Greg Maxey nous racontait que :
> Cissy,
>
[quoted text clipped - 6 lines]
>
> True masters please chime in here and educate Cissy and me.
I am not, by far, a true master. But, you could have everything in the
calling sub, which is what I usually try to do. I like to keep the userform
code as lean as possible so that the userform can be easily used in other
projects "as is".
'_______________________________________
Option Explicit
Private Sub Document_New()
Dim ofrmLetterhead As frmLetterHead
Dim myRange As Range
Dim oBkMark As Bookmarks
Set oBkMark = ActiveDocument.Bookmarks
Set ofrmLetterhead = New frmLetterHead
With ofrmLetterhead
.boolProceed = True
.txtRecName = ""
.txtRecFirm = ""
.txtAdd1 = ""
.txtAdd2 = ""
.txtCityStateZip = ""
.txtRecName.SetFocus
With .ComboBox1
.Style = fmStyleDropDownList
.BoundColumn = 0
.List = Array("Joe Barber", "Sue Turner Budd", _
"Alice Cohen", "Tom Chase", _
"Julie Detrick")
.ListIndex = 0
End With
.Show
If .boolProceed Then
oBkMark("bkRe").Range.Text = .txtRe
oBkMark("bkCC").Range.Text = .txtCc
oBkMark("bkSalutation").Range.Text = .txtSalutation
oBkMark("bkRecName2").Range.Text = .txtRecName
If .txtAdd1.Text = "" Then
With oBkMark("bkAdd1")
.Range.Paragraphs(1).Range.Delete
End With
Else
oBkMark("bkAdd1").Range.Text = .txtAdd1.Text
End If
Set myRange = oBkMark("bkSenderName").Range
myRange.Text = .ComboBox1.Text
Else
MsgBox "Procedure cancelled by user"
End If
End With
Unload ofrmLetterhead
Set ofrmLetterhead = Nothing
Selection.GoTo What:=wdGoToBookmark, Name:="bkStart"
End Sub
'_______________________________________
And in the userfrom:
'_______________________________________
Option Explicit
Public boolProceed As Boolean
'_______________________________________
Private Sub CmdBtnCancel_Click()
Me.boolProceed = False
Me.Hide
End Sub
'_______________________________________
'_______________________________________
Private Sub CmdBtnFinished_Click()
Me.Hide
End Sub
'_______________________________________
By the way, there are controls on the userform that are not being use to
populated the document and,
If .txtAdd1.Text = ""
is true, then
.Range.Paragraphs(1).Range.Delete
.Delete
will generate an error because of the double .Delete

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Greg Maxey - 11 May 2006 22:24 GMT
JGM,
Well at least you run with pack ;-)
Thanks for you input. Actually I don't think I have ever seen that much
code in the calling macro and was surprised by Cissy's original code. Of
course it works, but it seems that one or more sages has mildly chastised me
for putting *too much* code in the calling macro. I personally like the
ProcessForm idea, but as I mentioned, if it is put in the project you have
all the variables to declare as public blah, blah.
Will be interesting to see what others might say.

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> Greg Maxey was telling us:
> Greg Maxey nous racontait que :
[quoted text clipped - 100 lines]
> .Delete
> will generate an error because of the double .Delete