OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 13-07-2010, 13:49
kunghel kunghel is offline
Junior Member
 
Join Date: Jun 2010
Posts: 27
Default Simple Menu

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
Thank you!
Attached Images
 
Reply With Quote
  #2  
Old 13-07-2010, 13:56
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

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
...were chkConvert1 is the name of a checkbox

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
Reply With Quote
  #3  
Old 13-07-2010, 15:52
kunghel kunghel is offline
Junior Member
 
Join Date: Jun 2010
Posts: 27
Default

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
all individual codes are working when checked, however, he does not run one after the other.

Am I wrong in something?

Thanks.
Reply With Quote
  #4  
Old 13-07-2010, 15:54
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
What is the name of your check boxes?

-John
Reply With Quote
  #5  
Old 13-07-2010, 16:01
kunghel kunghel is offline
Junior Member
 
Join Date: Jun 2010
Posts: 27
Default

replace: name of form
preto: name of 1st check
todos: name of 2nd check
fassa: action buton
Reply With Quote
  #6  
Old 13-07-2010, 16:18
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

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"
It looks correct.

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
Reply With Quote
  #7  
Old 13-07-2010, 16:20
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

PS.
You may want to create a separate gms for your modules, rather than using GlobalMacros. This could be the problem.

-John
Reply With Quote
  #8  
Old 14-07-2010, 07:07
kunghel kunghel is offline
Junior Member
 
Join Date: Jun 2010
Posts: 27
Default

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
and this is my cod. of Commands.
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
What's happening:
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.
Reply With Quote
  #9  
Old 14-07-2010, 09:24
kunghel kunghel is offline
Junior Member
 
Join Date: Jun 2010
Posts: 27
Default Consegui!!!

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
Me I done right?
Please, can take a look Jhon?
Thank you.
Reply With Quote
  #10  
Old 14-07-2010, 10:57
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
Looks good!Removing the elseif was all that was needed.
-John
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
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


All times are GMT -5. The time now is 00:39.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com