OberonPlace.com Forums  

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

Thread Tools Search this Thread Display Modes
Old 03-03-2004, 15:22
Peter Clifton
Posts: n/a
Default Debugging help required

Hello All

Just got Draw V12 and have been trying out my earlier V11 macros. Some are failing, in particular this relatively simple one.

I can't work out why my Replace Objects macro (a clone of Alex's Object Replacer CorelScript) is failing.

If I single step through it (I set a break point at the start of the main For loop), it works, if I just run it fails to replace the object based on the form settings and move it to the originals location.

Could somebody help me get on the right track?

Link to the macro is in my sig at the bottom of this message

Thanks for any assistance

Reply With Quote
Old 03-03-2004, 16:08
Alex's Avatar
Alex Alex is offline
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default Re: Debugging help required


There is an issue with using ShapeRange and Selection objects which do not properly update their bounding box (position/size). Well, it all results in that you need to explicitly create a selection out of shape range before you get or set its size/position.

In your particular case, you need to add "nsr.CreateSelection" right after you aquired it through ActiveSelectionRange.

The selection bounding box is updated when the obejcts are drawn on the screen, that's why you macro works correctly when you debug through it. The shapes have a chance to refresh themselves when you step through the code however they don't if you run the macro in a single shot.

Also it seems that BeginCommandGroup/EndCommandGroup screw up things badly for some reason. Disabling this makes the macro run correctly (after the CreateSelection hack). I'm not sure why this happens though.
Reply With Quote
Old 03-03-2004, 18:28
Peter Clifton
Posts: n/a


Many thanks.

I like it when its an SEP (someone elses problem) :wink:

Also explains the failure of some of my other macros.

At least I know what to lookout for.

Thanks again

Reply With Quote

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

All times are GMT -5. The time now is 23:16.

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