bookmarks & userforms 
Author Message
 bookmarks & userforms

I am pasting the following code into VB after creating my bookmarks and
userform:

With ActiveDocument
    .Bookmarks("Text1").Range _
    .InsertBefore TextBox1
    .Bookmarks("Text2").Range _
    .InsertBefore TextBox2
End With

UserForm1.Hide

When I try to run the macro I get an error message... I am supposed to put
something into the _ following the word "range"?

Thanks,
Diane



Sat, 18 Jun 2005 03:49:45 GMT  
 bookmarks & userforms
Hi Diane

Format the code like this

With ActiveDocument
    .Bookmarks("Text1").Range.InsertBefore TextBox1
    .Bookmarks("Text2").Range.InsertBefore TextBox2
End With

UserForm1.Hide

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
Word FAQs at http://www.multilinker.com/wordfaq
Please post any follow-up in the newsgroup. I do not reply to Word questions
by email



Quote:
> I am pasting the following code into VB after creating my bookmarks and
> userform:

> With ActiveDocument
>     .Bookmarks("Text1").Range _
>     .InsertBefore TextBox1
>     .Bookmarks("Text2").Range _
>     .InsertBefore TextBox2
> End With

> UserForm1.Hide

> When I try to run the macro I get an error message... I am supposed to put
> something into the _ following the word "range"?

> Thanks,
> Diane



Sat, 18 Jun 2005 03:47:40 GMT  
 bookmarks & userforms
Diane

The Range is an object; in fact is it a object belonging to the
bookmark object.  What you are trying to do is to add text to a range
object.

Now, text and range objects are not the same thing so this is why this
is screaming.  What you need to do is to either copy the text to the
text of the range object:

 ... Range.Text

or to call the method .InsertBefore which insert text before the
object.

I hope this helps to explain what is going wrong as well as why.
Rather than just show the correct answer I this ought to clarify what
is going on for the future.

Malc
  www.dragondrop.com



Sun, 19 Jun 2005 05:49:21 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. UserForms, Textboxes & Bookmarks

2. Word Bookmarks, Userforms and Updates

3. Bookmarks, References and Userforms

4. userforms for bookmarks

5. Bookmarks in userforms, how do you populate more then one place

6. Help with Bookmarks and userforms

7. two questions on how to get data entries in userforms into bookmarks (if possible at all)

8. Check Boxes, Userforms Bookmarks

9. Basic steps for sequential & GoBackable userforms

10. Bookmark & Subform question

11. Word Automation & Bookmarks

12. Not a Valid Bookmark & Process stopped

 

 
Powered by phpBB® Forum Software