Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,616
- Office Version
- 365
- 2016
- Platform
- Windows
I have a textbox (shape - not a form control) named 'mapme5text' on my worksheet "MapMe5" (aka ws_mapme5). I would like to add dynamic text to that text box. I have this code in which I am attempting, and failing, to apply a dynamic custom message to that text box.
The line in red is leaving me with an error "Object doesn't support this property or method."
1) How do I apply the custom message (msgmain) to my text box? Clearly what I have tried isn't it. I tried .value instead of text and got the same error. BTW, ws_mapme5 is protected. Would it have to be unprotected to apply the message to the text box?
2) Can I use Chr(13) within my message concatenation to break the lines?
3) Is it possible to resize the text box shape based on the contents of the text box? I wish to avoid any dead space in the text box after the end of the message. This is so that I can move a button closer to the bottom of the text box.
4) How can I move the button to below the text box, once it's resized - if at all possible.
Thank you in advance for all the support.
Rich (BB code):
Sub btn_mapme4_Click()
Stop
ref = zone & Format(corridor, "00") & Format(segment, "00")
segref = Application.WorksheetFunction.Match(ref, ws_segments.Columns(1), 0)
segdesc = ws_segments.Cells(segref, 6)
segtype = ws_segments.Cells(segref, 7)
segdist = ws_segments.Cells(segref, 8)
segsurf1 = ws_segments.Cells(segref, 12)
segsurf2 = Application.WorksheetFunction.VLookup(segsurf1, ws_lists.Range("C:D"), 2, False)
segice = ws_segments.Cells(segref, 11)
msg1 = segdesc & " " & segtype
msg2 = segdist & " m. (" & segsurf2 & ")"
msg3 = "Ice: " & segice
msg4 = "Notice: Unavailable"
msg5 = "Hazard: Unavailable"
msgmain = msg1 & Chr(13) & msg2 & Chr(13) & msg3 & Chr(13) & msg4 & Chr(13) & msg5 & Chr(13)
Sheets("MapMe5").Shapes("mapme5text").Text = msgmain
Sheets("MapMe5").Activate
End Sub
The line in red is leaving me with an error "Object doesn't support this property or method."
1) How do I apply the custom message (msgmain) to my text box? Clearly what I have tried isn't it. I tried .value instead of text and got the same error. BTW, ws_mapme5 is protected. Would it have to be unprotected to apply the message to the text box?
2) Can I use Chr(13) within my message concatenation to break the lines?
3) Is it possible to resize the text box shape based on the contents of the text box? I wish to avoid any dead space in the text box after the end of the message. This is so that I can move a button closer to the bottom of the text box.
4) How can I move the button to below the text box, once it's resized - if at all possible.
Thank you in advance for all the support.