Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DMW DMW is offline
external usenet poster
 
Posts: 6
Default Textbox macro - update problem

Hi there

I'm working on Excel 2000 on a W2K machine. I am currently putting
together a data entry sheet, on which there is 1 textbox to allow a
lengthy entry to be both visible and printable. However, in the
background I have a hidden sheet which collates all the data in
columns. I currently have the following macro (code kindly provided by
another group member) assigned to my textbox to copy the text into a
cell for collation purposes:

Sub getext()
Dim s As String
ActiveSheet.Shapes("Text Box 9").Select
s = Selection.Characters.Text
Range("b100").Value = s
End Sub

This suceeds in copying the text but only after I click out and then
back into the textbox. Can anyone suggest how I can change my code to
instruct an afterupdate or lostfocus event, so that the cell is
updated? I'm stumped but thats because I've not got a clue when it
comes to VB. I've tried adding afterupdate or lostfocus after sub
getext but to no avail. Any help gratefully received as this is
driving me to distraction!!

Many thanks.

Donna

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Textbox macro - update problem

Can anyone suggest how I can change my code to instruct an afterupdate or
lostfocus event


The only event a text box on a sheet has is the click event. I'd suggest a
different approach if you want to use a text box on a sheet - remove the
macro from the text box and instead assign it to a button placed next to the
text box. Label the button something like "Commit" or "Click me when text
is complete".

--
Jim
"DMW" wrote in message
oups.com...
| Hi there
|
| I'm working on Excel 2000 on a W2K machine. I am currently putting
| together a data entry sheet, on which there is 1 textbox to allow a
| lengthy entry to be both visible and printable. However, in the
| background I have a hidden sheet which collates all the data in
| columns. I currently have the following macro (code kindly provided by
| another group member) assigned to my textbox to copy the text into a
| cell for collation purposes:
|
| Sub getext()
| Dim s As String
| ActiveSheet.Shapes("Text Box 9").Select
| s = Selection.Characters.Text
| Range("b100").Value = s
| End Sub
|
| This suceeds in copying the text but only after I click out and then
| back into the textbox. Can anyone suggest how I can change my code to
| instruct an afterupdate or lostfocus event, so that the cell is
| updated? I'm stumped but thats because I've not got a clue when it
| comes to VB. I've tried adding afterupdate or lostfocus after sub
| getext but to no avail. Any help gratefully received as this is
| driving me to distraction!!
|
| Many thanks.
|
| Donna
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
DMW DMW is offline
external usenet poster
 
Posts: 6
Default Textbox macro - update problem

Hi Jim

Thanks for this - its a great workaround. However, it presents me with
another problem. When you complete the text box, you cannot click
straight onto the command button - you have to click a cell to leave
the text box first and then click the command button. Is there a way
to eliminate this additional step as I want to make the use of this
form as simple as possible? Thanks you so much for your help so far.

Kind regards.

Donna


Jim Rech wrote:
Can anyone suggest how I can change my code to instruct an afterupdate or
lostfocus event


The only event a text box on a sheet has is the click event. I'd suggest a
different approach if you want to use a text box on a sheet - remove the
macro from the text box and instead assign it to a button placed next to the
text box. Label the button something like "Commit" or "Click me when text
is complete".

--
Jim


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Textbox macro - update problem

you cannot click straight onto the command button

That is true for a Control Toolbox command button. But if you use a Forms
toolbar button it's not an issue. Hopefully you can switch.

--
Jim
"DMW" wrote in message
ps.com...
| Hi Jim
|
| Thanks for this - its a great workaround. However, it presents me with
| another problem. When you complete the text box, you cannot click
| straight onto the command button - you have to click a cell to leave
| the text box first and then click the command button. Is there a way
| to eliminate this additional step as I want to make the use of this
| form as simple as possible? Thanks you so much for your help so far.
|
| Kind regards.
|
| Donna
|
|
| Jim Rech wrote:
| Can anyone suggest how I can change my code to instruct an afterupdate
or
| lostfocus event
|
| The only event a text box on a sheet has is the click event. I'd
suggest a
| different approach if you want to use a text box on a sheet - remove the
| macro from the text box and instead assign it to a button placed next to
the
| text box. Label the button something like "Commit" or "Click me when
text
| is complete".
|
| --
| Jim
|


  #5   Report Post  
Posted to microsoft.public.excel.programming
DMW DMW is offline
external usenet poster
 
Posts: 6
Default Textbox macro - update problem

Hi Jim

One word - fantastic! That has worked and solved the problem for me.
Thank you so much - your help is truly appreciated.

Kind regards.

Donna

Jim Rech wrote:
you cannot click straight onto the command button


That is true for a Control Toolbox command button. But if you use a Forms
toolbar button it's not an issue. Hopefully you can switch.





  #6   Report Post  
Posted to microsoft.public.excel.programming
DMW DMW is offline
external usenet poster
 
Posts: 6
Default Textbox macro - update problem

Hi Jim

It would appear that I have spoken too soon. The code is only copying
a certain amount of the text - not all of it. Do you have any ideas?

Thanks.

Donna
Jim Rech wrote:
you cannot click straight onto the command button


That is true for a Control Toolbox command button. But if you use a Forms
toolbar button it's not an issue. Hopefully you can switch.

--
Jim


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:47 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:43 PM
Dynamic update of UserForm TextBox Tom_C Excel Programming 7 January 15th 04 06:58 PM
Textbox on excel sheet do not update with VBA Ben Joiner Excel Programming 4 November 6th 03 11:07 AM
Textbox object does not update jay Excel Programming 0 August 1st 03 03:56 AM


All times are GMT +1. The time now is 08:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"