Hi,
I have this code which disables all Commands that can affect the geometry of the model, including running macros. I would like to be able to run macros while all other commands are disabled, so the question is if there is any way to override the disabledcommandtypes to enable running of macros while all other commands in "kEditMaskCmdType" are disabled?
/Lars
Sub Noneditble() Dim oDoc As Document Set oDoc = ThisApplication.activedocument oDoc.DisabledCommandTypes = kEditMaskCmdType End Sub
I have the code below, that should do some of what I Want, but it's not working - i get an error at line13 (oDoc.DisabledCommandList.Remove (oPrintCmd)). oDoc.DisabledCommandTypes = 4 ,disables file operations like save and print, and then i try to enable the print command again.
Sub ReadOnly() Dim oDoc As Document Set oDoc = ThisApplication.ActiveDocument oDoc.DisabledCommandTypes = 4 Dim oPrintCmd As ControlDefinition Set oPrintCmd = ThisApplication.CommandManager.ControlDefinitions.Item("AppFilePrintCmd") oDoc.DisabledCommandList.Remove (oPrintCmd) End Sub
One step closer, but still not enabling the print command.
Sub test() Dim oDoc As Document Set oDoc = ThisApplication.ActiveDocument oDoc.DisabledCommandTypes = 4 Dim controlDef As ControlDefinition For Each controlDef In ThisApplication.CommandManager.ControlDefinitions If (controlDef.InternalName = "AppFilePrintCmd") Then If controlDef.Enabled = False Then controlDef.Enabled = True End If Exit For End If Next End Sub
Can't find what you're looking for? Ask the community or share your knowledge.