1 Reply Latest reply: Sep 21, 2011 11:59 AM by Siarhei Karpusenka RSS

    Stylistics: "batch" paste gradient



      I am playing around with the visual aspect of an application. I have a whole bunch of little text objects on a sheet, and to make the sheet more visually appealing, I want to add some light gradient to the bg color of the text objects. The problem is that I will be changing the gradient settings A LOT, and it seems pointless to spend an hour on manually "pasting gradient" for each one of these text objects.


      I tried to go the Theme route, but there is a problem: the color of each text object is pulled from the database, and applying the theme just overwrites the set analysis required to grab the correct color. Unless there is a way to just limit the Theme to the gradient settings, rather than the whole set of Background settings?


      Any help is appreciated.




        • Re: Stylistics: "batch" paste gradient

          I was able to solve this problem by learning how to write macros


          For those of you, who run into a similar issue, the following macro loops through the active objects and changes the properties. Modify accordingly, of course.



          sub SetGradient


              objs = ActiveDocument.ActiveSheet.GetActiveSheetObjects

              for i = lBound(objs) to uBound(objs)         ' loop through all active objects


                  set aObj = objs(i)                       ' grab one object at a time


                  prop = aObj.GetProperties                ' store the original properties


                  prop.Layout.BkgColor.Luminosity = 75     ' set gradient to black

                  prop.Layout.BkgColor.Mode = 1            ' set 1-color gradient

                  prop.Layout.BkgColor.FillDirection = 0   ' set horizontal orientation

                  prop.Layout.BkgColor.FillPattern = 0     ' set light to dark pattern


                  aObj.SetProperties prop                  ' set the modified properties to the object



          end sub