Re: Macro to copy text from one text box to another
- From: "John" <John@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 3 Dec 2005 14:48:02 -0800
"Charles Kenyon" wrote:
> Do you want this to happen only if a command button is clicked or would you
> be satisfied if it happens automatically when the first value is changed and
> you move to the next field (calculate on exit)? If the latter you don't need
> any macro...
>
> From the FAQ
>
> 19. How can I enter something once in a document and have it repeat
> elsewhere?
> http://gregmaxey.mvps.org/Repeating_Data.htm
>
> --
> Charles Kenyon
>
> Word New User FAQ & Web Directory: http://addbalance.com/word
>
> Intermediate User's Guide to Microsoft Word (supplemented version of
> Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
>
> See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
> --------- --------- --------- --------- --------- ---------
> This message is posted to a newsgroup. Please post replies
> and questions to the newsgroup so that others can learn
> from my ignorance and your wisdom.
> "John" <John@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:297D6806-54EC-401F-BF0C-E6A96014ED6E@xxxxxxxxxxxxxxxx
> > Is it possible to create a macro that copies a text value from one text
> > box
> > on a word form to a second box on a page further down the document when a
> > command button is clicked.
> >
> > I have so far tried a simple macro of the type;
> >
> > Private Sub UserForm_Initialize()
> > TextBox1.Text = ""
> > TextBox2.Text = ""
> >
> > CommandButton1.Caption = "Cut and Paste"
> > CommandButton1.AutoSize = True
> > End Sub
> >
> > Private Sub CommandButton1_Click()
> >
> > TextBox1.SelStart = 0
> > TextBox1.SelLength = TextBox1.TextLength
> > TextBox1.Copy
> >
> > TextBox2.SetFocus
> > TextBox2.SelStart = 0
> >
> > TextBox2.Paste
> > TextBox1.SelStart = 0
> > End Sub
> >
> > Where am I going wrong?
> >
> >
>
>
> Thanks for that Charles,
I currently have some of the text in the form being copied with the
"calculate on exit" function but now need additional boxes that only copy the
text from one box to another when the command button is clicked.
But thanks for the advice and I will look over the links you suggested as
sure to pick up some other useful tips etc.
John.
.
- References:
- Re: Macro to copy text from one text box to another
- From: Charles Kenyon
- Re: Macro to copy text from one text box to another
- Prev by Date: Re: Need Help With Arrays and Passing Arguments
- Next by Date: Re: Max/Min Functions
- Previous by thread: Re: Macro to copy text from one text box to another
- Next by thread: Re: Macro to copy text from one text box to another
- Index(es):