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 / March 2007

Tip: Looking for answers? Try searching our database.

Change TextBox Focus

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
call_me_sol@yahoo.com - 03 Mar 2007 15:53 GMT
HI -
I created a text box.  The box accepts input from users. Upon hitting
the "paste" button, the text box replaces specific bookmarks within a
document.  After hitting paste, the text box closes.

I need to change the behavior of the text box so that upon hitting the
"paste" button, the test box goes to the background and the document
comes to the foreground becoming active. This will allow users to copy/
paste the contents of the document to be used elsewhere.  After users
have finished using the document, I need them to be able to return to
the text box (ideally, just clicking on it because it'll be in the
background) and starting the process over again (I added a "clear"
button to the text box already).

Is this possible?

Here is my current code:

Private Sub CommandButton1_Click()
Dim oRng As Word.Range
Dim oBMs As Bookmarks
Set oBMs = ActiveDocument.Bookmarks
Set oRng = oBMs("RD").Range
oRng.Text = TextBox1
oBMs.Add "RD", oRng
Set oRng = Nothing
Set oBMs = Nothing
Unload Me
End Sub

Private Sub CommandButton2_Click()
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
End Sub

Thank you for your help.
Doug Robbins - Word MVP - 03 Mar 2007 16:51 GMT
Just put a button on the toolbar to call the macro that you are using to
load the userform in the first place.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> HI -
> I created a text box.  The box accepts input from users. Upon hitting
[quoted text clipped - 34 lines]
>
> Thank you for your help.
call_me_sol@yahoo.com - 03 Mar 2007 17:27 GMT
Hi

Thanks for the reply.  I'd rather not do that.  The text box is going
to be used quite frequently (several dozen times) so it will become
sort of cumbersome to keep hitting a button on the toolbar to start
the box each time.

Is there anyway to make the text box fade to the background while its
not in use?  Then, when its clicked on again, make it come to the
foreground (essentially like toggling between two windows).  It seems
that right now when the text box is open I can only work IN the text
box -- i can't toggle into the document.

Thanks for the reply again, Doug.
Doug Robbins - Word MVP - 03 Mar 2007 19:12 GMT
I can't see any difference between having to click on a toolbar button and
clicking anywhere else.

If it needs several dozen clicks, there's a good chance that the whole
approach is somewhat less than optimal.

Note that you seem to bave posted this to microsoft.public.word.vba, which
is not a valid newsgroup.  You probably meant
microsoft.public.word.vba.general

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hi
>
[quoted text clipped - 10 lines]
>
> Thanks for the reply again, Doug.
call_me_sol@yahoo.com - 03 Mar 2007 19:32 GMT
Fair enough :)  I'm the novice here  -- lol

OK, so one last question.  I've added the button to the toolbar (which
looks like a "play" button).  When I do that, though, it prompts me to
choose a macro to run.  Is there any way to make the "play" button
simply start my macro -- the only macro in the template?

Thanks for all of the help, Doug.
 
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.