Sub Inset()
Dim eff1 As EffectSet eff1 = ActiveLayer.Shapes(2).CreateContour(cdrContourInside, 0.25, 1, cdrDirectFountainFillBlend, CreateCMYKColor(0, 0, 0, 100), CreateCMYKColor(0, 0, 0, 100), CreateCMYKColor(0, 0, 0, 100), 0, 0, cdrContourSquareCap, cdrContourCornerMiteredOffsetBevel, 15#)ActivePage.Shapes.All.CreateSelectionActiveSelection.Separate End Sub
Im getting this error saying parameter index is out of range. Help? This is a contour code assigned to a button for a work macro im making for easy access. My other buttons work well :) Thanks to John's little Tutorials.
How do i fix?
Basically it looks like this... I create Logo mats, so this is relevant to my work.Everything works but the inset.
I would check value 0.25 at cdrCountourInside (but I am not familiar with macros, so maybe it is wrong suggestion)
Mek
Hi.
I have cleaned up the code. You should more easily be able to see what's going on..
Sub InsetFix() Dim s As Shape, e As Effect, sr As ShapeRange Dim dVal# Dim colOutline As Color, colFill1 As Color, colFill2 As Color Set s = ActiveShape If s Is Nothing Then Exit Sub dVal = 0.25 Set colOutline = CreateCMYKColor(0, 0, 0, 100) Set colFill1 = CreateCMYKColor(0, 0, 0, 100) Set colFill2 = CreateCMYKColor(0, 0, 0, 100) Set e = s.CreateContour With e.Contour .Direction = cdrContourInside .offset = dVal .Steps = 1 .OutlineColor = colOutline .fillColor = colFill1 .FillColorTo = colFill2 .SpacingAcceleration = 0 .ColorAcceleration = 0 .EndCapType = cdrContourSquareCap .CornerType = cdrContourCornerMiteredOffsetBevel .MiterLimit = 15 End With Set sr = e.Separate 'do something with sr or the shapes it contains.End Sub
~John
HI.
Oh, your index was out of range probably for the 2 in you statement
Set eff1 = ActiveLayer.Shapes(2)
You probably recorded the macro with a few shapes on the page. The recorder wrote it as shape index number 2. Upon re-running the code you may have used it on a document with only 1 shape and the macro couldn't find shape 2.
Oh snap! It works, now when i get home i have to see what you changed to compare and contrast because i have been messing with this thing all night. and study it a bit.
But, I just couldnt identify the problem. It highlight the whole line for me, but i had no idea which part of the code was giving me an error.
This is awesome and a life saver! Thanks so much