Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I'm trying to build a Macro that will do selections on all the months (starting from Jan) untill the month that
have just been selected by the user.
i.e when the user selecting 'MAR' then the macro will select JAN+FEB+MAR.
I strarted writing it :
sub Select_Month
set val = ActiveDocument.Variables("maxMonth")
////// I build a Variable that holds the max selected month
a = val.GetContent.String
for i=1 to a
ActiveDocument.Fields("Month").Select i
???
next
end sub
Tips anyone? I should build an array somehow?
Thanks you very much
david
Well, you will always be selecting January and it looks like your months are just numbers. Something like:
sub Select_Month
set val = ActiveDocument.Variables("maxMonth")
a = val.GetContent.String
ActiveDocument.Fields("Month").Select i
for i=2 to a
ActiveDocument.Fields("Month").ToggleSelect i
next
end sub
Well, you will always be selecting January and it looks like your months are just numbers. Something like:
sub Select_Month
set val = ActiveDocument.Variables("maxMonth")
a = val.GetContent.String
ActiveDocument.Fields("Month").Select i
for i=2 to a
ActiveDocument.Fields("Month").ToggleSelect i
next
end sub
excellent!
Hi.
Try this.
sub Select_Month
set val = ActiveDocument.Variables("maxMonth")
a = val.GetContent.String
ActiveDocument.Fields("Month").Select "<="&a
end sub