Forms Code Problem

G

Guest

Please can someone help me with a forms problem? This is the first time I have done it, I followed all instructions given by Doug, but must be missing something as my form still will not work

I have set up named bookmarks and created a form to fill them in. I have renamed the default CommandButton1 to ENTER (to help the person filling out the form)

Here is my form code

Private Sub ENTER_Click(
With ActiveDocumen
..Bookmarks("name").Rang
InsertBefore TextBox
..Bookmarks("address1").Rang
InsertBefore TextBox
..Bookmarks("address2").Rang
..InsertBefore TextBox
..Bookmarks("address3").Rang
InsertBefore.TextBox
..Bookmarks("address4").Rang
InsertBefore TextBox
..Bookmarks("postcode").Rang
InsertBefore TextBox
..Bookmarks("salutation").Rang
InsertBefore TextBox
..Bookmarks("subject").Rang
InsertBefore TextBox

End Wit
UserForm1 Hid
End Su

In a new document, the form opens but nothing happens when I click the ENTER (CommandButton1) button
Please, please, tell me what I am missing out
Many thanks.
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

The following should be all on one line with a period between the words
Range and InsertBefore

.Bookmarks("name").Range.InsertBefore TextBox1

You should avoid using the word name as a name for something and also you
should assign names to the controls on the userform that are indicative of
their type and purpose. For example

.Bookmarks("Addressee").Range.InsertBefore txtAddressee

makes it easy to relate a bookmark named addressee with a textbox control
named addressee.
--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top