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!
Beautiful! Thank you :)
Can you tell me please the code to access the Window / Tile Vertically from macro. I'm using Corel X6.
Thank you very much