OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   Set Transparency using a variable (http://forum.oberonplace.com/showthread.php?t=24733)

nic 09-07-2015 17:35

Set Transparency using a variable
Im after writing a macro that will allow me to set the level of transparency on a set of individual shapes and would like to be able to set a variable and then use a line that says; "s.setTransparency = x" but recording the macro produced this very long line;


Sub setT()
    '    changes selected transparent objects level of transparency to 74
    Dim OrigSelection As ShapeRange
    Set OrigSelection = ActiveSelectionRange
    OrigSelection(1).Style.StringAssign "{""transparency"":{""uniformTransparency"":""0.73999999999999999"",""fill"":{""type"":""1""}},""fill"":{""type"":""1"",""overprint"":""0"",""primaryColor"":""RGB255,USER,255,0,0,100,8273965b-a0fd-4e34-a5c2-a29720146cc3"",""secondaryColor"":""CMYK,USER,0,0,0,0,100,00000000-0000-0000-0000-000000000000""},""outline"":{""color"":""CMYK,USER,0,0,0,100,100,00000000-0000-0000-0000-000000000000"",""width"":""2000""}}"
End Sub

I want to replace the

with :x, but the syntax has proved unguessable to me and I suspect I will also need to feed in other info - the colour and line width info. Would somebody point me in the right direction or throw some light on how to do this.

CDX6 Win 64

shark 10-07-2015 10:23

you could use each single shape in For-Each loop and change value of Transparency by using s.Transparency.Uniform = 74

nic 11-07-2015 07:15

Thanks Shark - that works perfectly.

All times are GMT -5. The time now is 00:43.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com