J
Jeri
I have created several bookmarks in my document. I then created a UserForm
(UserForm1) and added code to the command button on the form such as:
Private Sub CommandButton1_Click()
With ActiveDocument
.Bookmarks ("RecipientName").Range_
.InsertBefore TextBox1
.Bookmarks("RecipientReturnAddress").Range_
.InsertBefore TextBox2
.Bookmarks("RecipientCSZ").Range_
.InsertBefore TextBox3
.Bookmarks("ReferenceNo").Range_
.InsertBefore TextBox4
.Bookmarks("Salutation").Range_
.InsertBefore TextBox5
.Bookmarks("Scope").Range_
.InsertBefore TextBox6
.Bookmarks("PrimaryAttorney").Range_
.InsertBefore TextBox7
.Bookmarks("PrimaryAttorneyRate").Range_
.InsertBefore TextBox8
.Bookmarks("SecondaryAttorney").Range_
.InsertBefore TextBox9
.Bookmarks("SecondaryAttorneyRate").Range_
.InsertBefore TextBox10
.Bookmarks("MoniesRecoveredBy").Range_
.InsertBefore TextBox11
.Bookmarks("AmountsRecoveredFrom").Range_
.InsertBefore TextBox12
.Bookmarks("Retainer").Range_
.InsertBefore TextBox13
.Bookmarks("SigningAttorney").Range_
.InsertBefore TextBox14
.Bookmarks("DayofMonth").Range_
.InsertBefore TextBox15
.Bookmarks("Month").Range_
.InsertBefore TextBox16
.Bookmarks("TwoDigitsYear").Range_
.InsertBefore TextBox17
End With
UserForm1.Hide
End Sub
Bookmark names are enclosed in " " after .Bookmarks
and text box names are referenced after .InsertBefore
I created a macro that will show the userform.
WHen the userform is filled in and the command button is clicked, I get an
error message:
Compile error:
Method or data member not found
The vba window opens and .Range_ is highlighted
Any ideas what is going wrong?
Also, the macro that shows the userform - what do I need to call it to get
it to run automatically when the document is opened?
The file is saved as a .doc (Word 2003 Pro) - can't do a .dot in this
particular situation so it needs to be a doc, not a template.
THanks so much, in advance, for any assistance.
(UserForm1) and added code to the command button on the form such as:
Private Sub CommandButton1_Click()
With ActiveDocument
.Bookmarks ("RecipientName").Range_
.InsertBefore TextBox1
.Bookmarks("RecipientReturnAddress").Range_
.InsertBefore TextBox2
.Bookmarks("RecipientCSZ").Range_
.InsertBefore TextBox3
.Bookmarks("ReferenceNo").Range_
.InsertBefore TextBox4
.Bookmarks("Salutation").Range_
.InsertBefore TextBox5
.Bookmarks("Scope").Range_
.InsertBefore TextBox6
.Bookmarks("PrimaryAttorney").Range_
.InsertBefore TextBox7
.Bookmarks("PrimaryAttorneyRate").Range_
.InsertBefore TextBox8
.Bookmarks("SecondaryAttorney").Range_
.InsertBefore TextBox9
.Bookmarks("SecondaryAttorneyRate").Range_
.InsertBefore TextBox10
.Bookmarks("MoniesRecoveredBy").Range_
.InsertBefore TextBox11
.Bookmarks("AmountsRecoveredFrom").Range_
.InsertBefore TextBox12
.Bookmarks("Retainer").Range_
.InsertBefore TextBox13
.Bookmarks("SigningAttorney").Range_
.InsertBefore TextBox14
.Bookmarks("DayofMonth").Range_
.InsertBefore TextBox15
.Bookmarks("Month").Range_
.InsertBefore TextBox16
.Bookmarks("TwoDigitsYear").Range_
.InsertBefore TextBox17
End With
UserForm1.Hide
End Sub
Bookmark names are enclosed in " " after .Bookmarks
and text box names are referenced after .InsertBefore
I created a macro that will show the userform.
WHen the userform is filled in and the command button is clicked, I get an
error message:
Compile error:
Method or data member not found
The vba window opens and .Range_ is highlighted
Any ideas what is going wrong?
Also, the macro that shows the userform - what do I need to call it to get
it to run automatically when the document is opened?
The file is saved as a .doc (Word 2003 Pro) - can't do a .dot in this
particular situation so it needs to be a doc, not a template.
THanks so much, in advance, for any assistance.