mcomp72
Active Member
- Joined
- Aug 14, 2016
- Messages
- 275
- Office Version
- 365
- 2019
- 2016
- 2011
- Platform
- Windows
- MacOS
I have a textbox on one of my Excel sheets (created using Insert -> Text Box), and I want the text inside this textbox to appear inside a textbox that I have in a UserForm.
I have written code to try and make this happen, but it is not working, so I obviously don't understand the correct syntax to use. I have looked around at different forums looking for a solution, but every different variation of code I have tried hasn't worked. Whenever I run the UserForm, the textbox always appears empty.
Here's the code I have currently:
Any help to make this work would be appreciated.
I have written code to try and make this happen, but it is not working, so I obviously don't understand the correct syntax to use. I have looked around at different forums looking for a solution, but every different variation of code I have tried hasn't worked. Whenever I run the UserForm, the textbox always appears empty.
Here's the code I have currently:
Code:
Private Sub UserForm_Initilize()
Dim txBox_source As Shape
Dim txBox_target As Shape
Dim TextToCopy As String
Set txBox_source = Sheets("Storage").Shapes("LATextBox")
Set txBox_target = Me.LA_TextBox
TextToCopy = txBox_source.Text
txBox_target.Text = TextToCopy
End Sub
Any help to make this work would be appreciated.