I am trying to write a macro that'll find objects matching the currently selected object, since it's the function in 2020 is so bad.
Here's what I've collected so far from researching online (I do absolutely not know anything about VBA or coding)
And yes I am aware of JH Select Same (doesn't seem to work in 2020 though) and Select Pal from GDG.
With my own code I'll just be able to make a selection and click a button, plain and simple is what I'm aiming for.
Sub testo2()
Dim sMark
With ActiveSelection.ShapessMark = .CountIf sMark > 1 Then MsgBox "Mere end et objekt er markeret" Exit Sub End IfEnd With
Set s = ActiveShape If s Is Nothing Then MsgBox "Markér et objekt" Exit Sub End If
Dim sr As ShapeRangesh = ActiveSelection.SizeHeightsw = ActiveSelection.SizeWidth
ActiveDocument.Unit = cdrMillimeter
Set sr = ActivePage.Shapes.FindShapes(Query:="@height = {" & sh & "mm" & "} and @width = {" & sw & "mm" & "}")sr.CreateSelection
ActiveDocument.PreserveSelection = True ActiveDocument.RestoreSettings EventsEnabled = True Optimization = False ActiveWindow.Refresh Application.Refresh ActiveDocument.EndCommandGroup Exit Sub
End Sub
It seem's like I can run it one time, then if I select another object, the macro crashes...
Any suggestions? - and also, is it possible to search only for objects outside groups? (so I can group off objects I do not wanna touch)
danny102 said:And yes I am aware of JH Select Same (doesn't seem to work in 2020 though)
In what way does JH Select Same not seem to work in 2020?
I just tried a few simple tests, and it seemed to work as I would expect.
Just can't seem to make it run at my work pc, works perfectly fine on my home pc.They're setup with two different versions of CDR, my work pc has the newest version, I would've thought that was the reason.
I do have the selection pal from GDG on my work pc anyhow, works perfectly fine.
danny102 said:Just can't seem to make it run at my work pc, works perfectly fine on my home pc.
If you are never even seeing the Select Same userform when you try to run the macro, then you could try this:
FYI, I use JH Select Same rather frequently and it works fine in 2020, so if it doesn't it is probably something else.