Re: UserForm problems
From: Marshall (anonymous_at_discussions.microsoft.com)
Date: 02/18/04
- Next message: anonymous_at_discussions.microsoft.com: "Save changes to Web tools control in document with macro(s)"
- Previous message: Jonathan West: "Re: UserForm problems"
- In reply to: Jonathan West: "Re: UserForm problems"
- Next in thread: Jay Freedman: "Re: UserForm problems"
- Reply: Jay Freedman: "Re: UserForm problems"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 18 Feb 2004 10:21:12 -0800
I already know that the two phrases (UserForm.Hide &
Me.Hide) are synonymous. Either can be used.
I know that the issue is somewhere in the first line. I
have modified the code a bit to use a different method,
but I still get an error in the line:
BMRange.Text = TextToUse
Way down at the bottom.
Why does it not understand me?
Here is my updated code:
Private Sub btnSUBMIT_Click()
' Declare variables for this procedure
Dim ProtectType As Integer, i As Integer
Dim ZipOK As Boolean
Dim ErrMsg As String
' Check for any empty textbox
If (bxCONAME.Text = "") Then
MsgBox "Please enter the Company Name", , "Company
Name empty"
bxCONAME.SetFocus
Exit Sub
End If
If (bxATTN.Text = "") Then
MsgBox "Please enter the name of the person
receiving this letter", , "ATTN empty"
bxATTN.SetFocus
Exit Sub
End If
If (bxYRNAME.Text = "") Then
MsgBox "Please enter Your Name", , "Your Name
empty"
bxYRNAME.SetFocus
Exit Sub
End If
If (bxDEAR.Text = "") Then
MsgBox "Please enter the name of the person to
whom this letter will be sent", , "DEAR empty"
bxDEAR.SetFocus
Exit Sub
End If
' Insert the information into the bookmarks
With ActiveDocument
ProtectType = .ProtectionType
' If the document is protected, you have to
' unprotect it in order to fill the bookmarks
If Not (ProtectType = wdNoProtection) Then
.Unprotect
End If
' Call macro below to update bookmarks without
deleting them
UpdateBookmarkProc "bkTO", bxCONAME
UpdateBookmarkProc "bkATTN", bxATTN
UpdateBookmarkProc "bkFROM", bxYRNAME
UpdateBookmarkProc "bkDEAR", bxDEAR
' Update any reference fields
' .Fields.Update
' If the document was originally protected,
' put back the same protection
If Not (ProtectType = wdNoProtection) Then
.Protect ProtectType, True
End If
End With
Unload Me
End Sub
Private Sub UpdateBookmarkProc(BookmarkToUpdate As
String, TextToUse As Variant)
Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks
(BookmarkToUpdate).Range
BMRange.Text = TextToUse
ActiveDocument.Bookmarks.Add BookmarkToUpdate, BMRange
End Sub
>-----Original Message-----
>Hi Marshall,
>
>The problem is probably the UserForm1.Hide line. It isn't
needed, delete it.
>If you want to hide a userform from code within the form,
then you should
>use Me.Hide.
>
>--
>Regards
>Jonathan West - Word MVP
>http://www.multilinker.com
>Please reply to the newsgroup
>
>
>"Marshall" <anonymous@discussions.microsoft.com> wrote in
message
>news:11bb201c3f634$003918a0$a101280a@phx.gbl...
>> I am having the same dificulty with my userform that
rrush
>> originally posted. I get an error that says "Compile
>> Error: Method or Data Member Not Found". below is what I
>> have so far:
>> Private Sub btnSUBMIT_Click()
>>
>>
>> vCONAME = UserForm1.txtCONAME.Text
>> vATTN = UserForm1.txtATTN.Text
>> vYRNAME = UserForm1.txtYRNAME.Text
>> vDEAR = UserForm1.txtDEAR.Text
>>
>> ActiveDocument.FormFields("bkCONAME").Result =
vCONAME
>> ActiveDocument.FormFields("bkATTN").Result = vATTN
>> ActiveDocument.FormFields("bkYRNAME").Result =
vYRNAME
>> ActiveDocument.FormFields("bkDEAR").Result = vDEAR
>>
>>
>> UserForm1.Hide
>> Unload Me
>>
>> End Sub
>>
>> It is a form with 4 fields, and each field dumps info
(or
>> is supposed to) into the document. I can't seem to get
the
>> info to link into the document. HELP!
>>
>> Marshall
>
>.
>
- Next message: anonymous_at_discussions.microsoft.com: "Save changes to Web tools control in document with macro(s)"
- Previous message: Jonathan West: "Re: UserForm problems"
- In reply to: Jonathan West: "Re: UserForm problems"
- Next in thread: Jay Freedman: "Re: UserForm problems"
- Reply: Jay Freedman: "Re: UserForm problems"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|