Hi Folks,
Can anyone help me write a macro to select a rectangle shape with the pick tool after I manually create it? Normally, when you're done creating a rectangle, the rectangle tool remains selected. I'd like it to automatically return to the Pick tool (with the newly created object selected) after manually creating a rectangle.
Thanks very much,
Jack
try
SendKeys (" ")
or
SendKeys Chr$(vbKeySpace)
both worked for me on CD2019
Would you be willing to tap the Space Bar? That will toggle from the active tool to the Pick Tool, or from the Pick tool to the most recently active tool.
I've never gotten used to the space bar. In the flow of work, I often have to hit it several times to work. A long time ago - in Coreldraw v3.0, I think - the program always went back to the pick tool after creating a shape. It got burned into my synapses and I've never gotten used to the new way. It's just a nuisance that has bugged me for years. I've written a few scripts in the past, but this one is eluding me.
Cool - Thanks for the tip. Would this work with a ShapeCreated event? Any chance for an example of how to implement after a rectangle is created? :-)
Sub Macro1() Dim OrigSelection As ShapeRange Set OrigSelection = ActiveSelectionRange Dim s1 As Shape Set s1 = ActiveLayer.CreateRectangle(1.990303, 4.236996, 6.478492, 1.343295) s1.Rectangle.CornerType = cdrCornerTypeRound s1.Rectangle.RelativeCornerScaling = True s1.Fill.ApplyNoFill s1.Outline.SetPropertiesEx 0.007874, OutlineStyles(0), CreateCMYKColor(0, 0, 0, 100), ArrowHeads(0), ArrowHeads(0), cdrFalse, cdrFalse, cdrOutlineButtLineCaps, cdrOutlineMiterLineJoin, 0#, 100, MiterLimit:=5#, Justification:=cdrOutlineJustificationMiddle
Rem SendKeys (" ")
End Sub