Quick Question -
Is there a way to open Corel's Document Properties document via vba? I want to use it as a means to double check to see if the metadata i inputed via my macro stuck! Sometimes it doesn't so i'd like for the dialog box to pop up after to check.
Another way to show the Document Properties dialog:
1 2 3
Sub open_document_properties() Application.FrameWork.Automation.InvokeItem "3324df3f-e302-4946-8ba9-6b1511700818" End Sub
Thanks Eskimo! Awesome! I have been trying to figure out how to use control ID's. Your answer just taught me enough about Corel VBA to be dangerous .
Application.FrameWork.Automation.InvokeItem "3324df3f-e302-4946-8ba9-6b1511700818" ' ID = Document Properties dialog
This taught me that by using InvokeItem with a given ID, one can cleanly execute (invoke) most any menu or commandbar item directly from VBA using the ID of the control.
The Sendkeys method I posted earlier will do the job, however it is bug prone because it performs keyboard operations outside of the running code to achive its goal. I highly recomend using Eskimo's method instead.
For anyone needing a way to find the long control ID's, the code snippet below will return a list with the ID for each item on a given menu. The list appears on the debug screen, so you can easily copy and paste the ID's you need directly into your code.
sMenu = "the menu you need the control ID from"
Sub listMenuItemIDs() Dim cntrl As Control, sMenu As String sMenu = "File" ' or "Edit" or "View" or any menu you need an ID from. For Each cntrl In CommandBars(sMenu).Controls Debug.Print cntrl.ID, cntrl.Caption NextEnd SubWith minor changes this snippet can return ID's for controls on commandbars other than the menus.Thanks everyone for the question and the answer. This will solve so many things. Happy Coding!
In your code, if you set sMenu ="Text" you apparently get the ID for the Text toolbar, not Text from the menu bar.
What I'd really like to find is the control IDs for the options on Text>Change Case
There are a few Commands that might be useful, depending on what you wish to do.
I don't know if there are any other ready-made Commands related to case. If not, then you might need to write some code if you need something more specific as a one-click operation.
You can't record Change Case options(even those that have an Icon Available for them), And yes, I need code that would allow a single click/hotkey especially for Sentence Case and Title Case. Any ideas?