Does someone have other ideas? And I just found I had some misinput in previous reply.
I have a *.iam & *.ipt which include iLogic code to generate different models which will depend on input.
I do not want user to edit my code. So I want when user pushs "Cancel" button or ""X" icon (Close), the application to be automatically closed. Of course, I have a code to check if the user is myself, the application will be still open so I can continue.
The issue is: when other user uses my iLogic model, if he push "Cancel" button in InputBox window, it works fine which could let application to be closed immediately, but when user pushes "X" icon (Close) in InputBox, Inventor asks user whether save the file. In this windows, if user push "Cancel" button or "X" icon, the application still open and he can edit my code which is not what I want.
I would like put my code here in order someone could help me find solution.
SyntaxEditor Code Snippet
Do
ControlCode = UCase(InputBox("Please Input Control Code:" _
& vbLf & "A" _
& vbLf & "B" _
& vbLf & "C" _
& vbLf & "D" _
& vbLf & "E" _
& vbLf & "F" _
& vbLf & "G", Title, "A"))
If ControlCode = "" Then
iLogicVb.RunRule("Check Edit Permission")
Exit Sub
End If
Loop While ControlCode <> MultiValue.FindValue(MultiValue.List("ControlCode"), "=", ControlCode)
My Rule "Check Edit Permission" as below
SyntaxEditor Code Snippet
oUsername = Environ("Username")
If oUsername <> MultiValue.FindValue(MultiValue.List("oCreator"), "=", oUsername) Then
ThisApplication.Quit
Exit Sub
End If
When user push "Cancel" button in InputBox Window, "Check Edit Permission" works fine.
But if user push "X" icon in InputBox Window, Inventor will pop-up a window ask User whether he wants to Save or Cancel. In this window, if user pushes "X" icon again, the applicaiton will not quit and he can edit my code now which is not what I want.