![]() |
#1
|
|||
|
|||
![]()
I use several macros in corel draw it saves lot of time. Actually I am novice for VB, but I use cut paste method and achieve what I want by trying to understand the codes, It really works for me.
Here is my question. After executing a macro, when I use undo command, (using 'Ctrl Z') -- I go back only one step and not all actions of macros are undone. How can I make corel draw treat the whole macro as one single command. So when I press Ctrl Z whole macro is undone. |
#2
|
|||
|
|||
![]()
You can do that by ActiveDocument.BeginCommandGroup e.g.
Code:
ActiveDocument.BeginCommandGroup "my crunchy macro" [stuff in the macro you want to undo in one swell foop here] ActiveDocument.EndCommandGroup Edit -> Undo my crunchy macro -> Redo my crunchy macro Hope this helps. |
#3
|
||||
|
||||
![]()
I would just add to this that it is important to include an error handler, so your undo stack does not become corrupt if something goes wrong. So something like this works great:
Code:
Sub Test() ActiveDocument.BeginCommandGroup "My Command" On Error Goto ErrHandler ' Place your code here ExitSub: ActiveDocument.EndCommandGroup Exit Sub ErrHandler: MsgBox "Error occured: " & Err.Description Resume ExitSub End Sub Shelby |
#4
|
|||
|
|||
![]()
Thanks both of you it works great. Priviously it use to take away my ability to undo 100 times.
Thanks once again |
![]() |
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 |
Cannot use Curveworks macros in a user witten macro??? | jon46089 | CurveWorks | 2 | 02-03-2006 15:18 |
Help with Replace Macro | Pumpkin_Masher | Macros/Add-ons | 1 | 21-09-2005 15:41 |
musthave macro: REPEAT LAST COMMAND custom number of times | wOxxOm | CorelDRAW/Corel DESIGNER VBA | 3 | 04-09-2005 13:08 |
Clearing Undo List | lasergraver | CorelDRAW/Corel DESIGNER VBA | 4 | 15-08-2004 12:34 |
New macro to clip curves w.r.t. a border | Gerard Hermans | Macros/Add-ons | 0 | 09-06-2003 08:50 |