Bookmark data in UserForm?

T

TomorrowsMan

Is there a simple way to add a bookmark reference to a userform popup?

The user selects five ratings of 1-4, which get totaled to the bookmark
CompTot1 when the user clicks a "Validate" command_button on the page.
I would like a UserForm to popup that says, "Your subtotal is
[CompTot1]. Is this a performance review?

At that point the user clicks on command_button YES or NO, which takes
them to one of two different bookmarks.

I have the second half completed; but I'm finding it tricky to get the
CompTot1 bookmark subtotal into the UserForm; there's lots of info on
how to get userform data 'down' to the form, but not 'up' from it, if
that makes sense....

Thanks!

Chris
 
G

Greg Maxey

Chris,

Say you want the value of CompTot1 in textbox1 of the form:

Private Sub UserForm_Initialize()
Me.TextBox1.Value = ActiveDocument.Bookmarks("CompTot1").Range.Text
End Sub
 
T

TomorrowsMan

Thank you!

It's almost perfect -- the only thing is, it returns the value
"FORMTEXT X.XX," where X.XX is the number I am trying to show in the
userform. So instead of getting "Your rating is 3.50" I am getting
"Your rating is FORMTEXT 3.50".

Any way to truncate this to just the number?

Thanks again!

Chris
 
T

TomorrowsMan

Ah, ha! think I figured it out!

I added your script to the UserForm_Activate() Sub, and that seems to
be doing the trick!

Thanks again!
 

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