1 Reply Latest reply: Sep 5, 2011 9:37 AM by Robert Svebeck RSS

    Aplly a Theme via macro

      This work fine


      Sub ThemeMountain()

        Set obj01 = ActiveDocument.GetSheetObject("CS01")

                Set obj02 = ActiveDocument.GetSheetObject("BU08")

                Set obj03 = ActiveDocument.GetSheetObject("BU09")

                Set obj04 = ActiveDocument.GetSheetObject("BU10")



                obj01.ApplyTheme "D:\QlikView\Develop\Themes\Mountain.qvt"

                obj02.ApplyTheme "D:\QlikView\Develop\Themes\Mountain.qvt"

                obj03.ApplyTheme "D:\QlikView\Develop\Themes\Mountain.qvt"

                obj04.ApplyTheme "D:\QlikView\Develop\Themes\Mountain.qvt"


      End sub



      But if I want to get all objects in the active sheet how can I program a macro to change all objects




      Sub ThemeMountain2()


           Dim obj as Object

            ' Set vPath = "D:\QlikView\Develop\Themes\Espresso.qvt"



                     For each obj in ActiveSheet

               obj.ApplyTheme "D:\QlikView\Develop\Themes\Mountain.qvt"


            '  obj.ApplyTheme vPath

           Next obj



      End sub

        • Aplly a Theme via macro

          This macro will set a theme on all ojects in all sheets in the document:


          Sub SetTemplateOnAllObects
          for j = 0 to ActiveDocument.NoOfSheets - 1
          Objects = ActiveDocument.GetSheet(j).GetSheetObjects
          for i = lBound(Objects) To uBound(Objects)
          set obj = Objects(i)  
          obj.ApplyTheme "c:\qv_theme.qvt"
          End Sub



          Good luck!

          Just skip the first loop (all sheets) and you should be ok.


          //Robert Svebeck