I am trying to write a macro that will create a slightly oversized rectangle around any given object. It didn't take long for me to run into a wall. The CreateRectangle command requires 4 values. I need my created rectangle to reference the ActiveSelectionRange and add 10mm to the x & y values. I have no idea how to do this. It also needs to inherit the original selection coordinates, centered.
So in the end, if I were to apply the macro to a 10mm diameter circle, it would create a 20 x 20mm rectangle that is centered on the circle. I need a rectangle, so using contours is not viable.
It does not need to inherit fills, outline or colour properties, nothing fancy. Just that.
I'd be grateful for any assistance
try attached macro (ziiped as site doesn´t allow to upload gms files)
8078.Add_Rectangle.zip
Thank you
I learned more from your solution about setting and referencing object values than I did in hours of reading VBA documentation. It is actually quite intuitive
You might have a look at some of the content provided by Sub GDG_John( ) - GDG Macros VBA Lessons.
Lots of opportunity there to see it / hear an explanation / try it yourself / start tweaking it.
This is an excellent suggestion, I am enjoying the video series. I've actually used some of John's macros in the past, if I had known about his tutorials I would have watched years ago
Tutorial lesson 4 is actually exactly what I wanted to do here
I'm glad to know that you are finding those useful. I appreciate the time and care that John put into those tutorials. I would have benefited from becoming aware of those much sooner than I did!
I would like to see an updated "Lesson 1" video for that series. I think that some of the information in the original version may not work as shown with more recent versions of CorelDRAW and more recent versions of Windows.
I continue to be disappointed that Corel doesn't have something like a "Macros for Users" section on the Community site. I think that a lot of opportunities are being missed there for discussion and sharing - including the ability to easily direct people to resources such as John's great tutorials.