![]() |
#1
|
|||
|
|||
![]()
Ola!
I am setting up a macro to be able to better organize the macros that I am using. I have two macros: One to replace the shapes in black RGB to CMYK black (Thanks to Shelby and Jhon for this) and another to convert all RGB to CMYK After pressing the "Do it Now!" it converts what was selected. The question is: How do I work? Attached the visual. and my activation will be some like this: Code:
GMSManager.RunMacro "KunghelMacros", "Ferramentas.RGB_Preto_para_CMYK_Preto" 'and GMSManager.RunMacro "KunghelMacros", "Ferramentas.Converter_vetores_para_CMYK |
#2
|
||||
|
||||
![]()
Hi.
In the vba, form editor view double click the command button. You can put something like this in the sub it creates (ie. cmd_click) Code:
Private Sub cmdDoIt_Click() If frmMain.chkConvert1.value Then 'run a macro or sub ElseIf frmMain.chkConvert2.value Then 'run a macro or sub End If End Sub and frmMain is the name of the form (not needed if code is in form). You may want to put the subs for your macro in a module that's in the same GMS and refer to them like this myModule1.mySub1 -John |
#3
|
|||
|
|||
![]()
Please Jhon
Check this Code:
Private Sub fassa_Click() If replace.preto.Value Then 'run a macro or sub GMSManager.RunMacro "GlobalMacros", "Módulo1.check" ElseIf replace.todos.Value Then 'run a macro or sub GMSManager.RunMacro "GlobalMacros", "Módulo1.bgo" End If End Sub Am I wrong in something? Thanks. |
#4
|
||||
|
||||
![]()
Hi.
What is the name of your check boxes? -John |
#5
|
|||
|
|||
![]()
replace: name of form
preto: name of 1st check todos: name of 2nd check fassa: action buton |
#6
|
||||
|
||||
![]()
Hi.
Make sure you referred to the gms/sub correctly. Here's an example of one of mine. gdg_vinylEasyV2 is the name that shows first in the project explorer. This is the module name. GDG is the name of the module. VinylEASY is the name of the sub in the module. Code:
GMSManager.RunMacro "gdg_vinylEasyV2", "GDG.VinylEASY" Also, Learning to debug will help you greatly. Go to view and make your locals window appear. Next click in the gray area right next to the IF statement and make a break point. Run macro, click on cmd button. This will take you to the break point. Press f8 on the keyboard to watch the sub execute slowly. Watch and examine your locals window for values that will get assigned. -John |
#7
|
||||
|
||||
![]()
PS.
You may want to create a separate gms for your modules, rather than using GlobalMacros. This could be the problem. -John |
#8
|
|||
|
|||
![]()
Ok! see this.
I rewrote it again: this is the Cod. Form of: Code:
Private Sub Act_Buton_Click() If Form_replacer.Convert_Black.Value Then 'run a macro or sub GMSManager.RunMacro "KunghelMacros", "Cod_Replacers.RGB_Black_to_CMYK_Black" ElseIf Form_replacer.Convert_All.Value Then 'run a macro or sub GMSManager.RunMacro "KunghelMacros", "Cod_Replacers.All_RGB_to_CMYK" End If End Sub For now, I just put a MsgBox for some tests. Code:
Sub RGB_Black_to_CMYK_Black() MsgBox "Done! All Blacks are converted." End Sub Sub All_RGB_to_CMYK() MsgBox "Done Too! All RGB are converted." End Sub When selected the 1st Checker (Convert_Black), it runs. When selected the 2st Checker (Convert_All), it runs. When selected both only the 1st run. My need is: When selected both, run 1st after the 2nd. |
#9
|
|||
|
|||
![]()
Ola!
I changed the code and got the overall result I needed. Follows: Code:
Private Sub Act_Buton_Click() If Form_replacer.Convert_Black.Value Then 'run a macro or sub GMSManager.RunMacro "KunghelMacros", "Cod_Replacers.RGB_Black_to_CMYK_Black" End If If Form_replacer.Convert_All.Value Then 'run a macro or sub GMSManager.RunMacro "KunghelMacros", "Cod_Replacers.All_RGB_to_CMYK" End If End Sub Please, can take a look Jhon? Thank you. |
#10
|
||||
|
||||
![]()
Hi.
Looks good!Removing the elseif was all that was needed. -John |
![]() |
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 |
How can I add a new menu to the coreldraw by the VBA | levin | CorelDRAW/Corel DESIGNER VBA | 15 | 17-07-2011 14:35 |
This should be simple | resa | Corel Photo-Paint VBA | 1 | 15-10-2007 16:46 |
Drawing a 'T', a simple Q | madhur | General | 3 | 18-09-2007 06:37 |
How I can add my own menu on menu bar | Vlada | CorelDRAW/Corel DESIGNER VBA | 4 | 28-08-2006 18:53 |
simple example | chinkyk | CorelDRAW/Corel DESIGNER VBA | 3 | 19-10-2004 14:50 |