Hello there,
Im struggling with series of macros and one part of the whole chain has to be: select Object (shapes)"One" and "Two", then combine. Objects are already renamed but can't figure out how to select them by their names.
Can someone help me?Thank you very much.
I finded a simple macro which find one object by name, but I need to select two objects.
Sub Test01() Dim s As Shape Set s = ActivePage.FindShape("One") If Not s Is Nothing Then s.CreateSelection Else ActiveDocument.ClearSelection End IfEnd Sub
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Sub test_select_named_shapes() Dim sr As New ShapeRange Dim sOne As Shape Dim sTwo As Shape Set sOne = ActivePage.Shapes.FindShape("One") Set sTwo = ActivePage.Shapes.FindShape("Two") If Not sOne Is Nothing And Not sTwo Is Nothing Then sr.Add sOne sr.Add sTwo sr.CreateSelection Else ActiveDocument.ClearSelection End If End Sub
Eskimo Thank you good sir, I owe you one :)
I have two new problems, if you can help me, it would be nice.
__________________________________________________________
1st Is possible to run chain of separated (recorded) macros? They have names: Macro1, Macro2, Macro3, ETC.
2nd How the hell I create marco for exporting PNG (transparent background) from CDR, any idea?
Atrey said:2nd How the hell I create marco for exporting PNG (transparent background) from CDR, any idea?
You may be using one of these methods:
Sometimes there is more than one way to do something because one way is an "older" way, and another way is a "newer" way.
I wrote a macro that can export .PNG and .JPG, and I use Document.ExportEx in that.
It is like you said, Im new in creating macros, right now I creating macro which should export specific PNGs. Right now, I have dozen of macros, some are recorded and some are picked from this forum (writen by hand).I will check your suggestions, and hopefully find the right solution, once again thank you.
People here on the forums are happy to help with this, so do not be afraid to ask.
As with many things, getting started can be the hardest part. As you learn more, it becomes easier to ask specific questions to solve specific problems.
Working through the tutorials from Sub GDG_John( ) can be a great way to become familiar with VBA in CorelDRAW... and the object model... and using the VBA editor... and how to test code... etc.
For some "ready to use" macros, see my blog: Eskimo's Macros and More.