I was curious if anyone has run into the need to grey out the "Save Copy As" functionality under File?
I tried to run the same code that I'm using to disable other commands but it doesn't seem to disable the command. I'm wondering if I have to do something different since it's an embedded command? Any help would be appreciated.
Public Sub DisableAssemblySaveCopyAsCmd() '(oAssyDoc As AssemblyDocument)
Dim oDrawDoc As DrawingDocument: Set oDrawDoc = ThisApplication.ActiveDocument
'***********************************************************************************************************************************
' DISABLES THE MIRROR COMMAND WITHIN A SPECIFIED ASSEMBLY DOCUMENT
'***********************************************************************************************************************************
Dim oCtrlDef As ControlDefinition
If oDrawDoc Is Nothing Then Exit Sub
For Each oCtrlDef In ThisApplication.CommandManager.ControlDefinitions
If oCtrlDef.DisplayName = "&Save Copy As..." Then
oCtrlDef.Enabled = False
'Call oDrawDoc.DisabledCommandList.Add(oCtrlDef)
End If
Next
End Sub
Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Solved! Go to Solution.
I was curious if anyone has run into the need to grey out the "Save Copy As" functionality under File?
I tried to run the same code that I'm using to disable other commands but it doesn't seem to disable the command. I'm wondering if I have to do something different since it's an embedded command? Any help would be appreciated.
Public Sub DisableAssemblySaveCopyAsCmd() '(oAssyDoc As AssemblyDocument)
Dim oDrawDoc As DrawingDocument: Set oDrawDoc = ThisApplication.ActiveDocument
'***********************************************************************************************************************************
' DISABLES THE MIRROR COMMAND WITHIN A SPECIFIED ASSEMBLY DOCUMENT
'***********************************************************************************************************************************
Dim oCtrlDef As ControlDefinition
If oDrawDoc Is Nothing Then Exit Sub
For Each oCtrlDef In ThisApplication.CommandManager.ControlDefinitions
If oCtrlDef.DisplayName = "&Save Copy As..." Then
oCtrlDef.Enabled = False
'Call oDrawDoc.DisabledCommandList.Add(oCtrlDef)
End If
Next
End Sub
Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Solved! Go to Solution.
Solved by Michael.Navara. Go to Solution.
Solved by Tiffany_Hayden_. Go to Solution.
Found the issue! the display name is "Save Copy"
Public Sub DisableAssemblySaveCopyAsCmd() '(oAssyDoc As AssemblyDocument)
Dim oDrawDoc As DrawingDocument: Set oDrawDoc = ThisApplication.ActiveDocument
'***********************************************************************************************************************************
' DISABLES THE SAVE COPY AS COMMAND WITHIN A SPECIFIED DOCUMENT
'***********************************************************************************************************************************
Dim oCtrlDef As ControlDefinition
If oDrawDoc Is Nothing Then Exit Sub
For Each oCtrlDef In ThisApplication.CommandManager.ControlDefinitions
If oCtrlDef.DisplayName = "Save Copy" Then
'If InStr(oCtrlDef.DisplayName, "Save Copy") > 0 Then
Debug.Print oCtrlDef.DisplayName & ", " & oCtrlDef.DescriptionText
oCtrlDef.Enabled = False
'Call oDrawDoc.DisabledCommandList.Add(oCtrlDef)
End If
Next
End Sub
Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Found the issue! the display name is "Save Copy"
Public Sub DisableAssemblySaveCopyAsCmd() '(oAssyDoc As AssemblyDocument)
Dim oDrawDoc As DrawingDocument: Set oDrawDoc = ThisApplication.ActiveDocument
'***********************************************************************************************************************************
' DISABLES THE SAVE COPY AS COMMAND WITHIN A SPECIFIED DOCUMENT
'***********************************************************************************************************************************
Dim oCtrlDef As ControlDefinition
If oDrawDoc Is Nothing Then Exit Sub
For Each oCtrlDef In ThisApplication.CommandManager.ControlDefinitions
If oCtrlDef.DisplayName = "Save Copy" Then
'If InStr(oCtrlDef.DisplayName, "Save Copy") > 0 Then
Debug.Print oCtrlDef.DisplayName & ", " & oCtrlDef.DescriptionText
oCtrlDef.Enabled = False
'Call oDrawDoc.DisabledCommandList.Add(oCtrlDef)
End If
Next
End Sub
Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Easier and language independent way is to use InternalName of button definition.
Dim cmdInternalName = "AppFileSaveCopyAsCmd"
ThisApplication.CommandManager.ControlDefinitions(cmdInternalName).Enabled = False
What is the internal name of command you can get from EventWatcher (tool from Inventor SDK).
Select UserInputEvents.OnActivateCommand and click the button in Inventor. In log window the internal name is displayed.
Easier and language independent way is to use InternalName of button definition.
Dim cmdInternalName = "AppFileSaveCopyAsCmd"
ThisApplication.CommandManager.ControlDefinitions(cmdInternalName).Enabled = False
What is the internal name of command you can get from EventWatcher (tool from Inventor SDK).
Select UserInputEvents.OnActivateCommand and click the button in Inventor. In log window the internal name is displayed.
@Michael.Navara Very Cool! Thanks so much!
Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
@Michael.Navara Very Cool! Thanks so much!
Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Can't find what you're looking for? Ask the community or share your knowledge.