DesignMode = False

KniteMare

Board Regular
Joined
Mar 4, 2002
Messages
238
I'm looking to do something like

If Application.DesignMode = True Then
Application.DesignMode = False
Else
End If

The Idea is to stop users from putting the program into Design Mode and disableing macros.

The above will not work as it is written. What struck me as curious is that when I typed application.designmode

EXCEL changed it to Application.DesignMode as if EXCEL reccognized this a a key word.

Whats up with that?

Yours in EXCELent Frustration

KniteMare

_________________
Of course I can, and it will take only 900 hours of programming time to do it.
This message was edited by KniteMare on 2002-08-27 04:36
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi Knite,

I'm not aware of any way to disable design mode altogether. But you can disable the Design Mode buttons on the various toolbars. For example, for the Visual Basic and Controls toolbars:

CommandBars("Visual Basic").Controls("Design Mode").enabled=False
CommandBars("Control Toolbox").Controls("Design Mode").enabled=False

And don't forget to set them true when done.
 
Upvote 0
Damon,

Thanks for the reply.

Yes I know that I can disable controls. I do this with an OnOpen routine in which I also disable everything that has to do with Cut and Paste so that the users cannot damage my nice little formulas.


I wanted to see if I could get Design Mode to disable contingent on some user action.

Occasionally the users must remove the passsword for editing (They need to do this to add emloyees and edit schedules)

I have a "Can't Touch That" routine which keeps their little paws off the cells that have formulas. That way even with the password off they are moved two cells down and two cells right if they click in a restricted cell.

If they first enable DesignMode this routine fails to run and they can damage the program.
When I was playing with the Application.DesignMode thing I noticed Excel addressing it as if it was a reserved Key Word. But, I could not find a reference to the Key Word DesignMode anywhere.

Oh well, thanks for the help anyway. I may utilize your suggestion and disable it at start-up and re-enable it at Close or DeActivate. I'll have to decide if it is more trouble than it is worth.

Yours in EXCELent Frustration

KniteMare
 
Upvote 0
Hi again Knite,

Something I have used on occasion in place of cell locking or using the ChangeSelection event is to use cell validation to prevent entry of any value greater than 0 characters in length (obviously this prohibits any entry). It is not ironclad in terms of preventing someone with malicious intent from obliterating your formulas, but it does prevent unintentional harm as well as providing the capability for a nice popup message that the cell is restricted.

Damon
 
Upvote 0
Just to add. The whole idea of design mode is to prevent macros from running... so, what you're asking can't be done. The easy thing to do would be to disable that control everywhere. Then, they couldn't be in Design Mode !
 
Upvote 0
On 2002-08-26 18:23, Juan Pablo G. wrote:
Just to add. The whole idea of design mode is to prevent macros from running... so, what you're asking can't be done. The easy thing to do would be to disable that control everywhere. Then, they couldn't be in Design Mode !

Juan
Thats True, But try this Routine by attaching it to a Commandbutton (NOT ActiveX)
You'll find that you can Actually run this routine to PUT the Application in DesignMode.
THEN, if you press the Button again it will Take you OUT of DesignMode ?!

<pre/>
Sub DisableDesignmode()
On Error Resume Next
Application.CommandBars("Exit Design Mode").Enabled = True
Application.CommandBars.FindControl(ID:=1605).Execute
MsgBox "Running"
End Sub
</pre>
 
Upvote 0
Weird... I never get the MessageBox though (2000 and XP), do you ?

If i put a breakpoint at the beggining, the "Design Mode" is turned off automatically by Excel, I guess so the button can execute its macro ?
 
Upvote 0
On 2002-08-26 21:26, Juan Pablo G. wrote:
Weird... I never get the MessageBox though (2000 and XP), do you ?

If i put a breakpoint at the beggining, the "Design Mode" is turned off automatically by Excel, I guess so the button can execute its macro ?

Xl2000 win98, Yes I get the msgbox when it comes out of designmode and as expected NO msgbox when it enters Designmode.
 
Upvote 0
Ivan,
That's neat!
In my application I put all the commands I allow the users to access as part of a custom menu system (Loads up on the Menu Bar at Open or Activate). Then I disable all the rest. I did not disable the Design Mode as sometimes I need it. With your routine I can password protect a menu Item that will allow me to reactivate Design mode when I need it. I am going to try this approach today.

With the menu system I currently use the user can access the routines with out regard to the state of Design Mode and the last thing that happens when any menu item is selected is Excel goes out of design mode. n(f they put it in) So it appears EXCEL is deactivating Design Mode of its own (at times sinister) free will.

Anyway the discussion the question generated was interesting, as I find this forum to always be!

Damon,
Your Validation process involving a Zero string was reciently brought to my attention. I am going to try it in conjunction with the "Can't Touch That" routine I use now. The reason for this is that while the validation disallows entry of anything, it does not disallow Deleting the formula. I am going to play around and try to find a way around this.

Thanks all for the interesting responses.

Yours in EXCELent Frustration

KniteMare
 
Upvote 0
the following tried in Workbook Module .... Works! ( how could I get it to work automatically, tried Worksheets_Calculate() and it didn't work :mad:

Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Application.VBE.MainWindow.Visible = True Then
Call VBSecurity
End If
 

End Sub

Anyone any ideas??

Many thanks in anticipation...

Regds

Tom
 
Upvote 0

Forum statistics

Threads
1,218,690
Messages
6,143,940
Members
450,516
Latest member
shironokuro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top