1 Reply Latest reply: Nov 17, 2011 6:28 PM by vct.8311 RSS

    Macro only works the first time?

      I have a macro that is only working the first time it is executed with a button.  It also works when I push the test button from the Edit Module box.  This is getting a bit frustrating. Any thoughts???

       

      Requested Module Security is Safe Only

      Current Local Security is Safe Mode

       

      Here's the code but I don't think its the problem.

       

       

      Sub RestoreMainCharts()

      ' Temporarily turn off the AutoMinimize so that we can
      ' put 2 charts on the front panel without them auto-minimizing
      ' themselves.
      SetAutoMinimize "CH74", false
      SetAutoMinimize "CH75", false

      ActiveDocument.GetSheetObject("CH74").Restore
      ActiveDocument.GetSheetObject("CH75").Restore


      SetAutoMinimize "CH74", true
      SetAutoMinimize "CH75", true


      ' Minimize all the chart objects.
      ActiveDocument.GetSheetObject("CH67").Minimize
      ActiveDocument.GetSheetObject("CH68").Minimize
      ActiveDocument.GetSheetObject("CH69").Minimize
      ActiveDocument.GetSheetObject("CH70").Minimize
      ActiveDocument.GetSheetObject("CH72").Minimize
      ActiveDocument.GetSheetObject("CH73").Minimize



      End Sub

      Sub SetAutoMinimize(chart, state)
      rem ** Set auto-minimize flag for a chart **
      set g = ActiveDocument.GetSheetObject(chart)
      set gp = g.GetProperties
      gp.GraphLayout.Frame.AutoMinimize = state
      g.SetProperties gp

      End sub

       

      Thanks--