it is a extended version of your trying with a loop through variables to control the width from specific columns. I think it will be helpful.
dim doc, obj, varColumnList, varColumn, varColumnVisible, varColumnWidth, i, ii
set doc = ActiveDocument
set obj = doc.GetSheetObject("CH10012")
varColumnVisible = doc.Variables("vHelpColumnVisible").GetContent.String
if varColumnVisible = "on" then varColumnWidth = 40 else: varColumnWidth = 0
varColumnList = doc.Variables("vHelpColumnList").GetContent.String
varColumn = split(varColumnList, ";")
for i = 0 to ubound(varColumn)
if instr(varColumn(i), "-") = 0 then
obj.SetPixWidth varColumn(i), varColumnWidth
for ii = cint(left(varColumn(i), instr(varColumn(i), "-") - 1)) to cint(mid(varColumn(i), instr(varColumn(i), "-") + 1))
obj.SetPixWidth ii, varColumnWidth
Thanks for the answer. The problem that I'm having, however, is that I can't get the obj.SetPixWidth past the "Test" button in the macro window. I've got the following:
public sub MyHide
private sub HideColumn(ch,n)
set ch = ActiveDocument.GetSheetObject(ch)
ch.SetPixWidth (n), 50
I get "Object doesn't support this property or method: 'ch.SetPixWidth'"
I am using a stand-alone version so I don't have a server. I don't know if that has anything to do with it or what?