Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

Compile error in User Form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Doug Boufford - 28 Apr 2006 20:43 GMT
I am trying to setup a User Form as outlined at
http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

My bookmarks & fields are named
corpname
corpadd1
attention
yearend
retainer

My VBA code for the Command Button is as follows:

Private Sub CommandButton1_Click()
With ActiveDocument
    .Bookmarks("corpname").Range_
    .InsertBefore corpname
    .Bookmarks("corpadd1").Range_
    .InsertBefore corpadd1
    .Bookmarks("attention").Range_
    .InsertBefore attention
    .Bookmarks("yearend").Range_
    .InsertBefore yearend
    .Bookmarks("retainer").Range_
    .InsertBefore retainer
End With

UserForm1.Hide

End Sub

When I run the template, I get a compile error when I hit the command
button, after filling in the Userform.

I keep reviewing the instructions, but can't find where I messed up.

Any help appreciated

TIA
Doug
Jay Freedman - 28 Apr 2006 23:04 GMT
In each place where you have

  Range_

insert a space between the e and the underscore.

For an explanation, see
http://www.word.mvps.org/FAQs/MacrosVBA/_AtEndOfLine.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>I am trying to setup a User Form as outlined at
>http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm
[quoted text clipped - 35 lines]
>TIA
>Doug

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.