Has anyone figured out a way to have a macro read and change the setting for "Keep Desktop Objects on Layer" which is found on the Objects docker, "Gear"/settings menu? I would love to be able to check and change this using VBA.
If I understand correctly, "Keep Desktop Objects on Layer" is an application preference. As an example, I see in the Windows Registry a key named KeepDesktopObjectsOnLayer under Computer\HKEY_CURRENT_USER\SOFTWARE\Corel\CorelDRAW\23.0\Draw\Application Preferences\VGDoc Pref Settings.
As an aside: I really, really wish that they had made that a document property instead of an application preference.
I think that there is something in the API for checking and changing application preferences. See Application.GetApplicationPreferenceValue method and Application.SetApplicationPreferenceValue method.
I have messed aroud a little bit trying to use those methods for other settings, but never achieved success. If you learn more about using those methods, then please share, as I would love to learn more about them.
Here are a couple of examples of using GetApplicationPreferenceValue.
Sub UsingGetApplicationPreferenceValue() Dim v As Variant v = GetApplicationPreferenceValue("Bitmaps", "PreviewResolution") MsgBox "Bitmap Prevew Resolution: " & v v = GetApplicationPreferenceValue("VBA", "DelayLoadVBA") MsgBox "Delay Load VBA: " & v End Sub
Hope that helps,
-Shelby
Thank you for that, Shelby.
Do you know what one needs to do in order to make that work with the key NudgeOffset in the group Options - General?
Hi Eskimo. Did you ever figure out how to set the Nudge Offset value (nudge distance) using VBA? I would like to be able to include that in a macro if possible.
Ric Harrison said:Hi Eskimo. Did you ever figure out how to set the Nudge Offset value (nudge distance) using VBA?
I never succeeded in my attempts to use the Application.SetApplicationPreferenceValue method.
For the job of moving things back and forth using a specified value - e.g., to move some content away from other content for the sake of easier editing, and then moving it back again later - I now mostly use my Mover macro.
The value lists in the comboxes are very much under the users's control, so it's easy to have a number of desired values readily accessible, or to just have it reflect the most recently used values.
That's too bad. My work requires that I utilize various drawing scales in my CDR files. I oftentimes have to switch between scales so I created a couple macros for my toolbar that allow me to "send" and "receive" drawings scales between text objects and the CD world scale. My hope was that, once I updated the world scale, the nudge value would automatically be set to 1 rather than change to a percentage of whatever the previous scale was.
Hey, I like the custom combo box settings that you demonstrated in one of your videos. Very cool. I didn't know you could generate a popup context menu by right clicking on a userform object. Nice work.
I don't work much with WorldScale other than 1, and I had never thought about nudge working that way.
My Mover macro takes into account WorldScale, but I could imagine someone writing something similar, but that used absolute, "paper space" distances.