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?
I think that recording macros can sometimes help to learn some things about how CorelDRAW works.
However, recording has serious limitations. A lot of actions that can be performed in CorelDRAW cannot be recorded. When it does record things, it may produce code that is very different from code you might write "by hand" to do the same job.
The more you learn about writing VBA for CorelDRAW, the more you can do with it.
One place to start is the Developer Area; a number of resources there.
You might also have a look at some of the content provided by Sub GDG_John( ) - GDG Macros VBA Lessons; lots of good stuff there.
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.
If someone looking for answer for 1st, just look on this YT video.