Bill Hamilton
Board Regular
- Joined
- Mar 30, 2004
- Messages
- 91
Assign a macro to specific text in a textbox created by macro.
I'm generating a display of some information to the user containing data derived by a macro along with explanatory text. I then want the user to be able to Copy that data and paste it into the sheet he's seeing (or anywhere, really) while still viewing the generated display. I can't use either Msgbox or a Form as the focus apparently stays with that and text on those is not copyable anyway (?). Finally, whether or not the user decides to copy any text from what's displayed, he should then be able to dismiss it by clicking on, say, a 'Cancel' button or something.
Instead of those, I thought of using a Text Box, but so far I haven't found any way of getting a macro assigned to any internal text that is not part of anything he might want to copy so that the box can be dismissed once text has been copied.
For example, the display generated might show something like this:
Hi User,
If desired, please copy the text on the next line and paste it whereever you want.
(text to copy)
Dismiss this box by clicking HERE
Have a nice day, Bill
I want a method of allocating a macro to the word HERE so that the whole display can be removed automatically by clicking on it, whether or not the user selects and copies the text. Can a Command Button be inserted into a Text Box? That might do it. I know how to assign a macro to a whole Text Box, but that isn't any use here as the user must be able to select the copyable text.
From research that might not be possible, but I'd be delighted to be set straight.
If a Form can be made to do this I'd be grateful for an explanation. Forms aren't my strongest point unfortunately, but I'm familiar with the basics.
Any advice would be appreciated.
I'm generating a display of some information to the user containing data derived by a macro along with explanatory text. I then want the user to be able to Copy that data and paste it into the sheet he's seeing (or anywhere, really) while still viewing the generated display. I can't use either Msgbox or a Form as the focus apparently stays with that and text on those is not copyable anyway (?). Finally, whether or not the user decides to copy any text from what's displayed, he should then be able to dismiss it by clicking on, say, a 'Cancel' button or something.
Instead of those, I thought of using a Text Box, but so far I haven't found any way of getting a macro assigned to any internal text that is not part of anything he might want to copy so that the box can be dismissed once text has been copied.
For example, the display generated might show something like this:
Hi User,
If desired, please copy the text on the next line and paste it whereever you want.
(text to copy)
Dismiss this box by clicking HERE
Have a nice day, Bill
I want a method of allocating a macro to the word HERE so that the whole display can be removed automatically by clicking on it, whether or not the user selects and copies the text. Can a Command Button be inserted into a Text Box? That might do it. I know how to assign a macro to a whole Text Box, but that isn't any use here as the user must be able to select the copyable text.
From research that might not be possible, but I'd be delighted to be set straight.
If a Form can be made to do this I'd be grateful for an explanation. Forms aren't my strongest point unfortunately, but I'm familiar with the basics.
Any advice would be appreciated.