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 04-10-2004, 20:27
-=HKLC=-
Guest
 
Posts: n/a
Default Run a macro at startup with Corel 12 ?

How to run a macro at startup with Corel 12 ?
Reply With Quote
  #2  
Old 04-10-2004, 23:24
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default Re: Run a macro at startup with Corel 12 ?

Quote:
Originally Posted by -=HKLC=-
How to run a macro at startup with Corel 12 ?
Ok, this question comes up every now end then and I decided to answer it with some pictures

What you need to do is:

1. Start VBA editor by hitting Alt-F11 in CorelDRAW.
2. On the left hand side you'll see project explorer window. Locate "GlobalMacros (GlobalMacros.gms)" module.
3. Expand it until you see ThisMacroStorage under CorelDRAW 12 Objects.
4. Double-click on the ThisMacroStorage item and this will bring up the code window on the left (see the first picture in the attachment).
5. On top of the code window you'll see two list boxes. From the left list select "GlobalMacroStorage" (see Pic 2).
6. In the right list select "Start" event (see Pic 3).
7. This will add a new even handler for application Start event which is called when the application launches. (see Pic 4).
8. Add some code to that even handler. I added just a message box to indicate when the event is called (Pic 5).
9. Now to ensure that the even is called as soon as CorelDRAW starts, you need to make sure VBA is initialized at startup (which is not the default behavior). Go to Tools>Options>Workspace>VBA and at the bottom of the dialog, remove the checkbox from "Delay Load VBA". (Pic 6)

Now you should be all set.
Attached Images
      

Last edited by Alex; 07-11-2006 at 09:39.
Reply With Quote
  #3  
Old 04-10-2004, 23:51
-=HKLC=-
Guest
 
Posts: n/a
Default

I have been performed all step but not still run (
Reply With Quote
  #4  
Old 05-10-2004, 07:22
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default

Quote:
Originally Posted by -=HKLC=-
I have been performed all step but not still run (
Show Visual Basic For Applications toolbar and make sure the third button (VBA run/design mode) is not depressed. If it is depressed, then all VBA events are disabled.

Apart from this, I don't know why it doesn't work on your system. It works here on my CorelDRAW 12.
Attached Images
 
Reply With Quote
  #5  
Old 05-10-2004, 20:05
-=HKLC=-
Guest
 
Posts: n/a
Default

Ya, It is run very good but how to third button is not depressed automatic ?
Reply With Quote
  #6  
Old 05-10-2004, 20:25
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default

Quote:
Originally Posted by -=HKLC=-
Ya, It is run very good but how to third button is not depressed automatic ?
Well, this is the default state of CorelDRAW 12 anyway. This button is NOT depressed by default. It may be that you have pressed it at some point earlier (maybe by accident) and it stayed that way ever since.

This setting is stored in registry in the following key:

HKEY_CURRENT_USER\Software\Corel\CorelDRAW\12.0\CorelDRAW\Application Preferences\VBA - Global Document > DesignMode
Reply With Quote
  #7  
Old 05-10-2004, 21:57
-=HKLC=-
Guest
 
Posts: n/a
Default

Yeah, very good, tnx Alx
Reply With Quote
  #8  
Old 31-03-2005, 11:47
RVogel
Guest
 
Posts: n/a
Default Run macro on startup is not working for me...

I am using 11 and am trying to set up a macro to run automatically when a specific file is opened. I followed these instructions and under GlobalMacros, CorelDRAW11 Objects, ThisDocument I put the following code:

Private Sub GlobalDocument_Start()
Print_form.Show

End Sub

Then when I try to open the file I get an error message that "Cannot find file or one of its components, etc." I click OK and the form opens, but Corel is not. If I then close the form, Corel then opens to the file.

What am I doing wrong?
Reply With Quote
  #9  
Old 08-04-2005, 02:07
Michael Cervantes
Guest
 
Posts: n/a
Default How to delete an event handle in Global Macro

Alex I added your example of Active Page, and now I don't know how to erase it.

Best regards

Michael Cervantes
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
run a macro at startup with Corel 12 ? beny04 CorelDRAW/Corel DESIGNER VBA 2 26-04-2005 14:57
run macro at start up Corel 11 ???? -=HKLC=- CorelDRAW/Corel DESIGNER VBA 14 30-10-2004 09:29
Run my add-in on startup Corel. drg CorelDRAW/Corel DESIGNER VBA 5 16-09-2004 10:38
Corel 11 Macro arollgen CorelDRAW/Corel DESIGNER VBA 1 17-08-2004 16:10
New macro to clip curves w.r.t. a border Gerard Hermans Macros/Add-ons 0 09-06-2003 07:50


All times are GMT -5. The time now is 05:33.


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