PC Review


Reply
Thread Tools Rate Thread

Copying text within text box and having scroll bar appear

 
 
robs3131
Guest
Posts: n/a
 
      18th Feb 2008
Hi all,

I'm having two more issues with my form:

1 - I would like to have a command button on the form copy the text within a
text box on the form so that the user can then paste it into Notepad or Word
(and so that only the text is copied, not the formatting lines of code such
as "& vbnewline & _"). My code below is not working.

2 - I have set the "Scrollbars" attribute of the text box within the form to
"2 - frmScrollBarsVertical" -- the issue is that it doesn't appear until the
user actually clicks within the text box. I'd like it to appear as soon as
the code is executed. I noticed that a text box doesn't have the
"KppeScrollBarsVisible" attribute that a form does...

Thanks for your help!

Below is the code that executes when the commandbutton within the form is
clicked -- I get a "Compile Error: Invalid Qualifier" error:

Private Sub cmdcopymsg_Click()

With frmerrormsg
.txterrormsg.Text.Copy
End With

End Sub


--
Robert
 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      18th Feb 2008
To put text in the clipboard, use code like

Private Sub CommandButton1_Click()
Dim DataObj As MSForms.DataObject
Set DataObj = New MSForms.DataObject
DataObj.SetText Me.TextBox1.Text
DataObj.PutInClipboard
End Sub


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


"robs3131" <(E-Mail Removed)> wrote in message
news:BF515601-6E9C-49AD-8803-(E-Mail Removed)...
> Hi all,
>
> I'm having two more issues with my form:
>
> 1 - I would like to have a command button on the form copy the text within
> a
> text box on the form so that the user can then paste it into Notepad or
> Word
> (and so that only the text is copied, not the formatting lines of code
> such
> as "& vbnewline & _"). My code below is not working.
>
> 2 - I have set the "Scrollbars" attribute of the text box within the form
> to
> "2 - frmScrollBarsVertical" -- the issue is that it doesn't appear until
> the
> user actually clicks within the text box. I'd like it to appear as soon
> as
> the code is executed. I noticed that a text box doesn't have the
> "KppeScrollBarsVisible" attribute that a form does...
>
> Thanks for your help!
>
> Below is the code that executes when the commandbutton within the form is
> clicked -- I get a "Compile Error: Invalid Qualifier" error:
>
> Private Sub cmdcopymsg_Click()
>
> With frmerrormsg
> .txterrormsg.Text.Copy
> End With
>
> End Sub
>
>
> --
> Robert


 
Reply With Quote
 
robs3131
Guest
Posts: n/a
 
      18th Feb 2008
Thanks Chip - that worked perfectly!

I'm still stuck on getting the scrollbar on the textbox to appear without
the user having to click on the form...any idea there?

One other minor question while I'm at it -- is it possible to not have the
"x" appear on a form? I have a form that shows "Processing" that
automatically closes at the end of the sub.


Thanks so muich for your help!
--
Robert


"Chip Pearson" wrote:

> To put text in the clipboard, use code like
>
> Private Sub CommandButton1_Click()
> Dim DataObj As MSForms.DataObject
> Set DataObj = New MSForms.DataObject
> DataObj.SetText Me.TextBox1.Text
> DataObj.PutInClipboard
> End Sub
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft Most Valuable Professional
> Excel Product Group, 1998 - 2008
> Pearson Software Consulting, LLC
> www.cpearson.com
> (email on web site)
>
>
> "robs3131" <(E-Mail Removed)> wrote in message
> news:BF515601-6E9C-49AD-8803-(E-Mail Removed)...
> > Hi all,
> >
> > I'm having two more issues with my form:
> >
> > 1 - I would like to have a command button on the form copy the text within
> > a
> > text box on the form so that the user can then paste it into Notepad or
> > Word
> > (and so that only the text is copied, not the formatting lines of code
> > such
> > as "& vbnewline & _"). My code below is not working.
> >
> > 2 - I have set the "Scrollbars" attribute of the text box within the form
> > to
> > "2 - frmScrollBarsVertical" -- the issue is that it doesn't appear until
> > the
> > user actually clicks within the text box. I'd like it to appear as soon
> > as
> > the code is executed. I noticed that a text box doesn't have the
> > "KppeScrollBarsVisible" attribute that a form does...
> >
> > Thanks for your help!
> >
> > Below is the code that executes when the commandbutton within the form is
> > clicked -- I get a "Compile Error: Invalid Qualifier" error:
> >
> > Private Sub cmdcopymsg_Click()
> >
> > With frmerrormsg
> > .txterrormsg.Text.Copy
> > End With
> >
> > End Sub
> >
> >
> > --
> > Robert

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text Box Scroll Bars do not appear until you click in the text box RJQMAN@gmail.com Microsoft Excel Programming 3 13th Aug 2009 01:51 PM
Copying text from website OR selecting and coping certain text within a cell keri Microsoft Excel Programming 2 12th Apr 2007 11:23 PM
Can PowerPoint be used to Scroll text while updating same text on. =?Utf-8?B?SkI=?= Microsoft Powerpoint 2 6th Apr 2005 02:23 PM
when i scroll after copying some text, the copied text is lost =?Utf-8?B?UGFyYXN1cmFtYW4=?= Microsoft Word Document Management 0 21st Mar 2005 12:25 AM
how to scroll text out and scroll text in from next slide John Microsoft Powerpoint 1 18th Mar 2005 02:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:37 AM.