View Single Post
 
Old 10-07-2020, 11:39 PM
kiwimtnbkr kiwimtnbkr is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Oct 2017
Posts: 69
kiwimtnbkr is on a distinguished road
Default

Temporarily marking as 'unresolved'.

After getting some suggestions from colleagues, I put three form control command buttons onto the worksheet. Button 1 restarts the UserForm if it's been closed, button 2 causes the Print Preview and Print screen to open (same screen as File > Print would show) and button 3 causes the workbook to close without showing the 'save changes' prompt and they all work as expected when run within the worksheet.

The issue I have run into is when I press the command button on the Userform it throws the following error 'Run-time error 445: Object doesn't support this action'.

Clicking on the 'debug' button shows that it is erroring on the piece of code in red:

Code:
For Each aCtl In Me.frameMarking.Controls
    For Each aShape In aSheet.Shapes
      If aShape.Title = aCtl.Tag Then   <--this line here
        aShape.Visible = aCtl
      End If
    Next aShape
  Next aCtl
Is there an easy solution to this or am I too clever for my own good and having command buttons on the worksheet is not a good idea?
Reply With Quote