Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default Text Box - Moving Formatted Text

I am moving text from one textbox (from the drawing toolbar) on one sheet to
another textbox (on another sheet). I used these textboxes to allow for
copy/paste functionality, which I couldn't make work using the ControlToolbox
Textboxes . Anyway, when I move the data using the function below, It does
not move the formats (underline / bold) of the moved text. Any help would be
appreciated.

Thank you.

Sub moveit

Dim x1 As Integer
Dim Source1 As TextBox
Dim Target1 As TextBox
Dim Text1 As String

Set Source1 = sht1.DrawingObjects(1)
Set Target1 = sht2.DrawingObjects(1)

For x1 = 1 To Source1.Characters.Count Step 250

' Place the first text box text into a variable called theText.
Text1 = Source1.Characters(Start:=x1, Length:=250).Text

' Place the value of theText variable into second text box.
Target1.Characters(Start:=x1, Length:=250).Text = Text1

Next

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Text Box - Moving Formatted Text

I think your choices are to either copy the text box as a whole or to set
the each character's bold and underline property one at a time.

--
Jim
"Troubled User" wrote in message
...
I am moving text from one textbox (from the drawing toolbar) on one sheet
to
another textbox (on another sheet). I used these textboxes to allow for
copy/paste functionality, which I couldn't make work using the
ControlToolbox
Textboxes . Anyway, when I move the data using the function below, It
does
not move the formats (underline / bold) of the moved text. Any help would
be
appreciated.

Thank you.

Sub moveit

Dim x1 As Integer
Dim Source1 As TextBox
Dim Target1 As TextBox
Dim Text1 As String

Set Source1 = sht1.DrawingObjects(1)
Set Target1 = sht2.DrawingObjects(1)

For x1 = 1 To Source1.Characters.Count Step 250

' Place the first text box text into a variable called theText.
Text1 = Source1.Characters(Start:=x1, Length:=250).Text

' Place the value of theText variable into second text box.
Target1.Characters(Start:=x1, Length:=250).Text = Text1

Next

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default Text Box - Moving Formatted Text

I don't want to copy the entire textbox (for multiple reason, including that
I am doing this to about 50 different textboxes) anyway, I will try to write
something that moves them one at a time with a test for bold / underline for
each.

Thanks for your help. You will probably hear from me again!


"Jim Rech" wrote:

I think your choices are to either copy the text box as a whole or to set
the each character's bold and underline property one at a time.

--
Jim
"Troubled User" wrote in message
...
I am moving text from one textbox (from the drawing toolbar) on one sheet
to
another textbox (on another sheet). I used these textboxes to allow for
copy/paste functionality, which I couldn't make work using the
ControlToolbox
Textboxes . Anyway, when I move the data using the function below, It
does
not move the formats (underline / bold) of the moved text. Any help would
be
appreciated.

Thank you.

Sub moveit

Dim x1 As Integer
Dim Source1 As TextBox
Dim Target1 As TextBox
Dim Text1 As String

Set Source1 = sht1.DrawingObjects(1)
Set Target1 = sht2.DrawingObjects(1)

For x1 = 1 To Source1.Characters.Count Step 250

' Place the first text box text into a variable called theText.
Text1 = Source1.Characters(Start:=x1, Length:=250).Text

' Place the value of theText variable into second text box.
Target1.Characters(Start:=x1, Length:=250).Text = Text1

Next

End Sub




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Text Box - Moving Formatted Text

I think I'd copy all the text and then work on the formatting.

--
Jim
"Troubled User" wrote in message
...
I don't want to copy the entire textbox (for multiple reason, including
that
I am doing this to about 50 different textboxes) anyway, I will try to
write
something that moves them one at a time with a test for bold / underline
for
each.

Thanks for your help. You will probably hear from me again!


"Jim Rech" wrote:

I think your choices are to either copy the text box as a whole or to set
the each character's bold and underline property one at a time.

--
Jim
"Troubled User" wrote in message
...
I am moving text from one textbox (from the drawing toolbar) on one
sheet
to
another textbox (on another sheet). I used these textboxes to allow
for
copy/paste functionality, which I couldn't make work using the
ControlToolbox
Textboxes . Anyway, when I move the data using the function below, It
does
not move the formats (underline / bold) of the moved text. Any help
would
be
appreciated.

Thank you.

Sub moveit

Dim x1 As Integer
Dim Source1 As TextBox
Dim Target1 As TextBox
Dim Text1 As String

Set Source1 = sht1.DrawingObjects(1)
Set Target1 = sht2.DrawingObjects(1)

For x1 = 1 To Source1.Characters.Count Step 250

' Place the first text box text into a variable called theText.
Text1 = Source1.Characters(Start:=x1, Length:=250).Text

' Place the value of theText variable into second text box.
Target1.Characters(Start:=x1, Length:=250).Text = Text1

Next

End Sub






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default Text Box - Moving Formatted Text

Jim,

OK, I worked on this for several hours before seeing your response. I will
trust your judgement on altering the font after all the text has been moved.
So now I need to step through the source text character by character and
testing the font for bold and underlining. I created two string variables to
do this :

Dim TextBold As String
Dim TextUnd As String

I then changed the length to 1 via:

Text1 = Source1.Characters(Start:=x1, Length:=1).Text

and have tried to test Text1 using multiple different methods however I
can't get anything to return other than Invalid Qualifer errors. This got me
thinking that when I load the value into Text 1 that it need to have all its
text/font qualities, which I am not sure is the case if you load using .Text
as is above. Any help is greatly appreciated.

Thanks for any help you can provide. I will keep trying.


"Jim Rech" wrote:

I think I'd copy all the text and then work on the formatting.

--
Jim
"Troubled User" wrote in message
...
I don't want to copy the entire textbox (for multiple reason, including
that
I am doing this to about 50 different textboxes) anyway, I will try to
write
something that moves them one at a time with a test for bold / underline
for
each.

Thanks for your help. You will probably hear from me again!


"Jim Rech" wrote:

I think your choices are to either copy the text box as a whole or to set
the each character's bold and underline property one at a time.

--
Jim
"Troubled User" wrote in message
...
I am moving text from one textbox (from the drawing toolbar) on one
sheet
to
another textbox (on another sheet). I used these textboxes to allow
for
copy/paste functionality, which I couldn't make work using the
ControlToolbox
Textboxes . Anyway, when I move the data using the function below, It
does
not move the formats (underline / bold) of the moved text. Any help
would
be
appreciated.

Thank you.

Sub moveit

Dim x1 As Integer
Dim Source1 As TextBox
Dim Target1 As TextBox
Dim Text1 As String

Set Source1 = sht1.DrawingObjects(1)
Set Target1 = sht2.DrawingObjects(1)

For x1 = 1 To Source1.Characters.Count Step 250

' Place the first text box text into a variable called theText.
Text1 = Source1.Characters(Start:=x1, Length:=250).Text

' Place the value of theText variable into second text box.
Target1.Characters(Start:=x1, Length:=250).Text = Text1

Next

End Sub








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Text Box - Moving Formatted Text

This worked for me. I assumed that characters can be both bold and
underlined, btw.

Sub TransferBoldAndUnderline()
Dim TB1 As TextBox
Dim TB2 As TextBox
Dim Counter As Integer
Set TB1 = Sheet1.TextBoxes("Text Box 1")
Set TB2 = Sheet2.TextBoxes("Text Box 1")
For Counter = 1 To TB1.Characters.Count
If TB1.Characters(Counter, 1).Font.Bold Then
TB2.Characters(Counter, 1).Font.Bold = True
End If
If TB1.Characters(Counter, 1).Font.Underline Then
TB2.Characters(Counter, 1).Font.Underline = True
End If
Next
End Sub


--
Jim
"Troubled User" wrote in message
...
Jim,

OK, I worked on this for several hours before seeing your response. I
will
trust your judgement on altering the font after all the text has been
moved.
So now I need to step through the source text character by character and
testing the font for bold and underlining. I created two string variables
to
do this :

Dim TextBold As String
Dim TextUnd As String

I then changed the length to 1 via:

Text1 = Source1.Characters(Start:=x1, Length:=1).Text

and have tried to test Text1 using multiple different methods however I
can't get anything to return other than Invalid Qualifer errors. This got
me
thinking that when I load the value into Text 1 that it need to have all
its
text/font qualities, which I am not sure is the case if you load using
.Text
as is above. Any help is greatly appreciated.

Thanks for any help you can provide. I will keep trying.


"Jim Rech" wrote:

I think I'd copy all the text and then work on the formatting.

--
Jim
"Troubled User" wrote in message
...
I don't want to copy the entire textbox (for multiple reason, including
that
I am doing this to about 50 different textboxes) anyway, I will try to
write
something that moves them one at a time with a test for bold /
underline
for
each.

Thanks for your help. You will probably hear from me again!


"Jim Rech" wrote:

I think your choices are to either copy the text box as a whole or to
set
the each character's bold and underline property one at a time.

--
Jim
"Troubled User" wrote in
message
...
I am moving text from one textbox (from the drawing toolbar) on one
sheet
to
another textbox (on another sheet). I used these textboxes to allow
for
copy/paste functionality, which I couldn't make work using the
ControlToolbox
Textboxes . Anyway, when I move the data using the function below,
It
does
not move the formats (underline / bold) of the moved text. Any help
would
be
appreciated.

Thank you.

Sub moveit

Dim x1 As Integer
Dim Source1 As TextBox
Dim Target1 As TextBox
Dim Text1 As String

Set Source1 = sht1.DrawingObjects(1)
Set Target1 = sht2.DrawingObjects(1)

For x1 = 1 To Source1.Characters.Count Step 250

' Place the first text box text into a variable called theText.
Text1 = Source1.Characters(Start:=x1, Length:=250).Text

' Place the value of theText variable into second text box.
Target1.Characters(Start:=x1, Length:=250).Text = Text1

Next

End Sub








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
Moving text around cells without moving boarder lines Dale Excel Discussion (Misc queries) 1 December 15th 09 06:14 PM
Text in Text-formatted cells changes to ### after the 255th charac wildetudor Excel Discussion (Misc queries) 2 July 30th 09 03:20 PM
Moving a shape with text inside without editing text Dan Excel Programming 3 March 10th 07 11:33 PM
Dates formatted as text thekovinc Excel Discussion (Misc queries) 5 February 14th 06 06:49 PM
Converting 'General' formatted cells to Text formatted cell using. Zahid Khan Excel Worksheet Functions 1 March 12th 05 07:13 PM


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

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

About Us

"It's about Microsoft Excel"