![]() |
#1
|
|||
|
|||
![]()
Hi All:
I want to add a new menu to the coreldraw , but I do't know how to do so ? Thanks! |
#2
|
|||
|
|||
![]()
Hi Levin,
afaik you can't ![]() The CorelDraw 10 & 11 object models have a lot of classes like CommandBar(s), CommandBarControl(s), etc. You can add a new CommandBar with the Add method, but you can't create a button or menu item into it :!: I hope this will change with the next version... Jean-Marie |
#3
|
|||
|
|||
![]()
Hi JMP:
Thank for your reply, I will try to use CommandBar, It's also a method for my application. Hope later version will change as AutoCAD VBA! |
#4
|
|||
|
|||
![]()
Hi JMP and Alex:
I have try go do as you tell me , but now I have meet a question again. Here is the code which I Have written: Dim cmdbar As commandbar Set cmdbar= Application.CommandBars.Add("test") cmdbar.Visible = True How can add a new button the "test" command bar and link the button to a VBA form. Thank you! |
#5
|
|||
|
|||
![]()
Alas, I think you can't create a button into any CommandBar ! Perhaps with CorelDraw 12 ?
Jean-Marie |
#6
|
|||
|
|||
![]()
Topic revival: Anyone succeded with this in CorelDraw 12 :?:
Well I did ![]() 1. Searching for CommandBar (in order to prevent creating a CommandBar many times) Code:
Private Function FindCommandBarByName(cName As String) As CommandBar Dim nIndex As Long For nIndex = 1 To Application.CommandBars.Count If (Application.CommandBars.Item(nIndex).Name = cName) Then Set FindCommandBarByName = Application.CommandBars.Item(nIndex) Exit Function End If Next nIndex Set FindCommandBarByName = Nothing End Function Code:
Dim oToolbar As CommandBar Set oToolbar = FindCommandBarByName("ToolbarName") If oToolbar Is Nothing Then Set oToolbar = Application.CommandBars.Add("ToolbarName", cuiBarFloating, False) End If oToolbar.Visible = True 'Show it Code:
Dim oButton As CommandBarControl Set oButton = oToolbar.Controls.AddCustomButton _ ("Macros", "GMSName.ModuleName.MacroName", 1, False) Other stuff like assigning keyboard shortcut keys is under research ![]() Don't forget to add VBA referrence to VGCore (Corel - Vector Graphics Core 12.0 Type Library) |
#7
|
|||
|
|||
![]()
Hi Zlatev,
Thanks for the tip ! When I am applying your code to an existing macro, I can see the bar, but the button is grayed. However, if I add a new button by menu, this button is enabled ! Regards, Jean-Marie |
#8
|
||||
|
||||
![]()
Actually the category ID should be different, not "Macros".
This post will explain how to do it: http://www.oberonplace.com/forum/vie...hp?p=2235#2235 |
#9
|
|||
|
|||
![]()
Well on my CDR12 it worked fine with category "Macros" (with capital M)
Also you should specify existing GMS name, module name and the public sub name instead of GMSName.ModuleName.MacroName in code I also tested it with "2cc24a3e-fe24-4708-9a74-9c75406eebcd" - it works too. The strange thing is that I cannot find neither IID, neither CLSID in registry with this value. So it seems that this is neither Interface, nor Class in terms of Platform SDK meanings for Interface and Class. |
#10
|
|||
|
|||
![]() ![]() If I use "Macros" or the GUID as CategoryID, your code works fine with my french version. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
CorelDraw 10 DXF export relative coordinates - VBA solution? | asb617 | CorelDRAW/Corel DESIGNER VBA | 2 | 01-04-2010 02:34 |
CorelDraw 12 Menu items missing... | lasergraver | CorelDRAW/Corel DESIGNER VBA | 2 | 22-04-2004 10:51 |
Accesing CorelDraw 10 VBA Object Model without running it | dolmos | CorelDRAW/Corel DESIGNER VBA | 5 | 19-12-2003 07:52 |
Detect if VBA is installed (an answer and a question) | reanan | CorelDRAW/Corel DESIGNER VBA | 3 | 04-12-2002 14:35 |
CorelDraw 11 VBA DOM? | sdickson | CorelDRAW/Corel DESIGNER VBA | 2 | 03-12-2002 15:05 |