I have been using the function Workbook("file name.xlsm").Worksheets("Sheet 1").Shapes("command button 1").texrframe.characters.text = "my text". This works perfectly and changes the text on the command button. .Caption and .text don't seem to work at all
However, if the workbook is minimised, this command errors. I've watched the value in th VBE of the shape and that property resolves with an error while the workbook is minimised. if I restore the workbook to the desktop while the macro is suspended in debug, the command works and the macro proceeds as normal.
I'm trying to change the text on a command button within the workbook_resize event macro, which runs after the workbook minimises - I check to see if the windows state is minimised to change hot button text. My current workaround is to restore the window state to xlNormal, change the text, then re-minimise
Does anyone know why these,properties fail when the workbook is minimised and if there is a better way too do this?
Thanks
However, if the workbook is minimised, this command errors. I've watched the value in th VBE of the shape and that property resolves with an error while the workbook is minimised. if I restore the workbook to the desktop while the macro is suspended in debug, the command works and the macro proceeds as normal.
I'm trying to change the text on a command button within the workbook_resize event macro, which runs after the workbook minimises - I check to see if the windows state is minimised to change hot button text. My current workaround is to restore the window state to xlNormal, change the text, then re-minimise
Does anyone know why these,properties fail when the workbook is minimised and if there is a better way too do this?
Thanks