Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Moving text around cells without moving boarder lines | Excel Discussion (Misc queries) | |||
Text in Text-formatted cells changes to ### after the 255th charac | Excel Discussion (Misc queries) | |||
Moving a shape with text inside without editing text | Excel Programming | |||
Dates formatted as text | Excel Discussion (Misc queries) | |||
Converting 'General' formatted cells to Text formatted cell using. | Excel Worksheet Functions |