Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I was trying to help a user out -- but was unable to
His code (with my help, to date) is (in a standard module): (lines 3,4,5 are in 1 row of the code) - the below is wrapped Sub Text_Copy() Worksheets("Summary").Shapes("Text Box 3").TextFrame.Characters.Text = Worksheets("Description").Shapes("Text Box 1").TextFrame.Characters.Text & " " & Worksheets("Description").Shapes("Text Box 2").TextFrame.Characters.Text End Sub I had it working for "a while", but suddenly it quit working. What is suspicious about the above? Tks in Advance |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have it working reliably.
- Do you get an error message? - If so, what? - Does the problem still occur if you paste the code to a new wb and change sheet names and insert text boxes as required? Assuming the wks is protected, one guess is that Text Box 3 originally had the "Lock Text" checkbox unchecked and at some point it got checked. Perhaps through VBA (LockedText = True). So now, when the wks is protected, the macro will fail whereas it wouldn't have when it was unchecked. You should get the error message "Unalble to set the Text property of the Characters class". Assuming the wks is protected and xl2003 or higher, another guess is that the "Edit Objects" protection option formerly was checked and now is unchecked. Another guess is that sheet names or text box names have been accidently changed (maybe just a space?). Suggested code change (although there was nothing wrong with yours IMO):- Sub Text_Copy() Dim ch1 As Characters Dim ch2 As Characters Dim ch3 As Characters With Sheets("Description") Set ch1 = .Shapes("Text Box 1").TextFrame.Characters Set ch2 = .Shapes("Text Box 2").TextFrame.Characters End With With Sheets("Summary") Set ch3 = .Shapes("Text Box 3").TextFrame.Characters End With ch3.Text = ch1.Text & " " & ch2.Text End Sub Regards, Greg |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Greg;
Thanks so much for your input into this situation. My workbook or sheet is not protected in any way. I just ended up accepting your code (replacing mine) and everything is great. Thanks for your help. Much appreciated. Jim May "Greg Wilson" wrote: I have it working reliably. - Do you get an error message? - If so, what? - Does the problem still occur if you paste the code to a new wb and change sheet names and insert text boxes as required? Assuming the wks is protected, one guess is that Text Box 3 originally had the "Lock Text" checkbox unchecked and at some point it got checked. Perhaps through VBA (LockedText = True). So now, when the wks is protected, the macro will fail whereas it wouldn't have when it was unchecked. You should get the error message "Unalble to set the Text property of the Characters class". Assuming the wks is protected and xl2003 or higher, another guess is that the "Edit Objects" protection option formerly was checked and now is unchecked. Another guess is that sheet names or text box names have been accidently changed (maybe just a space?). Suggested code change (although there was nothing wrong with yours IMO):- Sub Text_Copy() Dim ch1 As Characters Dim ch2 As Characters Dim ch3 As Characters With Sheets("Description") Set ch1 = .Shapes("Text Box 1").TextFrame.Characters Set ch2 = .Shapes("Text Box 2").TextFrame.Characters End With With Sheets("Summary") Set ch3 = .Shapes("Text Box 3").TextFrame.Characters End With ch3.Text = ch1.Text & " " & ch2.Text End Sub Regards, Greg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
When drawing shapes in excel the shapes keep disappearing | Excel Discussion (Misc queries) | |||
Text wrap problem when printing labels/textboxes | Excel Discussion (Misc queries) | |||
tab between several textboxes | Excel Worksheet Functions | |||
How can i get more 3D shapes for Auto shapes in excel? | Excel Discussion (Misc queries) | |||
How can i get more 3D shapes for Auto shapes in excel? | Excel Discussion (Misc queries) |