RE: Insert sentence only if text field is not null
- From: Sandi V <SandiV@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 11 Jul 2008 10:00:26 -0700
Sorry to be dense: but where does this go?
I've got
Private Sub btnCancel_Click()
Me.Hide
ActiveDocument.Close wdDoNotSaveChanges
End Sub
Private Sub btnOK_Click()
On Error Resume Next
Dim oRng As Word.Range
'Populating Guarantor bookmarks:
Set oRng = ActiveDocument.Bookmarks("bkGName").Range
oRng.Text = Me.txtGName
ActiveDocument.Bookmarks.Add Name:="bkGName", Range:=oRng
Selection.GoTo What:=wdGoToBookmark, Name:="bkGName"
(etcetera)
Me.Hide
ActiveDocument.PrintPreview
ActiveDocument.ClosePrintPreview
Selection.GoTo What:=wdGoToBookmark, Name:="bkStartHere"
End Sub
If I try to include it under the OK button, I get "expected end sub" error.
This is the code I modified from yours, so far no decompile or run errors;
but the bkBorrowerName does not populate in the document.
Private Sub InsertBKBorrower()
Dim myRange As Range
With ActiveDocument
If .Bookmarks.Exists("bkBorrowerName") Then
myRange = .Bookmarks("bkBorrowerName").Range
myRange.Text = fcnBuildBKBorrower
.Bookmarks.Add "BkBorrowerName", myRange
End If
End With
End Sub
Private Function fcnBuildBKBorrower() As String
Dim Temp As String
Temp = txtBorrower1.Value
If Len(txtBorrower2.Value) > 0 Then
Temp = Temp & " and " & txtBorrower2.Value & ", each, a 'Borrower'
and any reference to 'Borrower' singly or 'Borrowers' collectively means each
as well of them in their individual, and joint and several capacities."
End If
fcnBuildBKBorrower = Temp
End Function
.
- Follow-Ups:
- Re: Insert sentence only if text field is not null
- From: Doug Robbins - Word MVP
- Re: Insert sentence only if text field is not null
- References:
- RE: Insert sentence only if text field is not null
- From: Gordon Bentley-Mix
- RE: Insert sentence only if text field is not null
- Prev by Date: Re: Application.screenupdating = false?? What's going on?
- Next by Date: Re: Header usage
- Previous by thread: RE: Insert sentence only if text field is not null
- Next by thread: Re: Insert sentence only if text field is not null
- Index(es):