😣 Now you are using 'ThisDoc.Document' to check DocumentType, but then using 'ThisApplication.ActiveDocument' to set the value of the DrawingDocument Type variable, which basically voided the check process. As I said, the two can represent completely different documents in some situations. You should use 'ThisDoc .Document' in both places, to avoid that potential problem. Or, if used outside of iLogic, since the term 'ThisDoc' is not available, you might be forced to use the term 'ThisApplication.ActiveDocument' in both places, but as we have noticed here, using that term may not work for this situation. There are other ways to refer to a specific document that you want a code to focus on outside of iLogic. Let me try to explain how the 'active' document may be the wrong one. When you are working with either an assembly, or a drawing, both can be referencing many other documents, and all of the documents that are being referenced within those documents will automatically be opened (not visibly, but in the background, which loads them into session memory). If that assembly is the one currently visible on your screen when you start an iLogic rule, or VBA macro, or other form of code, then by default, that assembly will remain the 'active' document throughout the course of what ever else may be happening while those codes are running, even if your code opens many other documents and works with them, and even if other iLogic codes are triggered to run by anything the main code does while it is running. So, none of those other documents will be the 'active' document, so if any other codes that get triggered to run are using the ThisApplication.ActiveDocument term to identify the document that they are to work on, they will essentially be targeting the main assembly, instead of the document they would normally be targeting if they were ran directly, with no other documents open. The same thing goes for if you are currently editing a component within an assembly, the 'active' document is still going to be the main assembly, not that component's document. Did you follow the link I provided in Message 6 above, and read through that article? That should help explain some of the document references better, to help you overcome some of these types of problems.
Since you never posted the text of your iLogic rule, just images of it, I had to re-create all of the code from scratch, in an attempt to provide you with an example that you can try out. I eliminated the MsgBox though, because it was not accomplishing anything anymore.
If ThisDoc.Document.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
Dim oDDoc As DrawingDocument = ThisDoc.Document
oCProps = oDDoc.PropertySets.Item("Inventor User Defined Properties")
For i = 1 To oDDoc.Sheets.Count
Dim oCProp As Inventor.Property = Nothing 'resets it
Try
oCProp = oCProps.Item("Scale" & i)
Catch
oCProp = oCProps.Add("", "Scale" & i)
End Try
Try
oCProp.Value = oDDoc.Sheets.Item(i).DrawingViews.Item(1).ScaleString
Catch
End Try
Next 'i
End If
Wesley Crihfield

(Not an Autodesk Employee)