Share via

Exiting design mode

Anonymous
2010-12-20T16:15:42+00:00

Hi Folks,

Is there a way to force an exit from design mode before saving? The problem is that while in design mode, VBA does not run, so saving the file while in design mode removes password protection placed through code.

Thanks!

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2011-01-11T16:30:25+00:00

    Actually, all you would have to do is directly after my code snippet place a call to the macro(s) that you would like to execute.


    "The new phonebooks are here!"

    The code you posted disables the design mode control in the Visual Basic toolbar, but not the Control Toolbox toolbar.

    Now I see what you are after though - if I disable design mode controls in the wookbook_open event, I don't have to worry about anyone fooling around with switching design mode on in the first place.

    Now I just have to get it to work in 2003, 2007, and 2010 versions...

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-01-07T16:20:16+00:00

    Actually, all you would have to do is directly after my code snippet place a call to the macro(s) that you would like to execute.


    "The new phonebooks are here!"

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2011-01-07T15:24:32+00:00

    You can add the following to the beforesave or the beforeclose event of the workbook...

     

     Dim dsMd As CommandBarControl

       

        Set dsMd = Application.CommandBars.FindControl(ID:=1605)

       

        If dsMd.Enabled = True Then

            dsMd.Enabled = False

        End If


    "The new phonebooks are here!"

    The problem is that when in design mode, VBA code is not processed and does not execute. So the file closes without running any code in either beforesave or beforeclose.

    Perhaps a workaround is to put this in the Workbook_SheetActivate and/or Workbook_SheetDeactivate events. I will give that a try...

    Thanks!

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2010-12-22T21:09:33+00:00

    You can add the following to the beforesave or the beforeclose event of the workbook...

     Dim dsMd As CommandBarControl

        Set dsMd = Application.CommandBars.FindControl(ID:=1605)

        If dsMd.Enabled = True Then

            dsMd.Enabled = False

        End If


    "The new phonebooks are here!"

    Was this answer helpful?

    0 comments No comments