Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm currently using a macro with an if statement that goes like this:
if ActiveDocument.Fields("%VIEW_NAME").GetSelectedValues.count > 0 then
ActiveDocument.Fields("PB_User_Flag").Lock
ActiveDocument.Fields("MASTER_ID").Lock
end if
Yet, when the macro is triggered, the above fields are not locking. Any insights??
the condition is true? did you try msgbox to test?
the Syntax Looks good. I made a small example (without condition ) and the field is locked
If i test with a text box in the dashboard GetSelectedCount(%VIEW_NAME), the result is 1. But when I test with a msgbox in the macro script, nothing appears. Not sure what is missing here.
try as first Expression in macro
what is the result? if not 1 then check your field
msgbox ActiveDocument.Fields(("%VIEW_NAME").).GetSelectedValues.count
I tested with same condition and for me it works!
Very strange, the message box comes up as 1, but then nothing locks.
can you lock the fields with button "lock"?
I think you need to create at first an object and could then query the count:
dim doc, myField
doc = ActiveDocument
set myField = doc.GetSelectedValues
' msgbox myField.count 'optional for check
if myField.count > 0 then
doc.Fields("PB_User_Flag").Lock
doc.Fields("MASTER_ID").Lock
end if
- Marcus
Hi, If you set the lock otuside the If(), it works?