3 Replies Latest reply: Dec 17, 2014 3:24 AM by phillip colbert RSS

    Macro Help - Set a Cell Value with Variable

    phillip colbert

      Hi,

       

      i need to set a cell in a straight table with a value from a variable.

       

      but my code isn't setting the cell with the value from the variable, instead its deleting the value from the variable. i think its getting the cell value (null) and setting the variable to it (null)

       

      rather than doing what i want which is to get the value from the variable and setting it to the cell!

       

      Sub GetTotal

       

      set ch = ActiveDocument.GetSheetObject("CH01").GetCell(1,5)  'empty cell to populate

      set vVar = ActiveDocument.Variables("vMyVariable") 'my variable that stores the value

      vVar.SetContent ch.text, false

       

      End Sub

       

      Help!

       

      Cheers.