Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi.
I have a macro which loops through a table of salesreps and emails them a report. I use the GetPossibleValues function to get the relevant email address for the salesperson from the rep table. I am striking a problem when the email address is blank in the table and therefore the GetPossibleValues does not return a value. This results in a macro error. If there is a null value returned then I'd like to use a generic email address instead.
Is there some command to identify that no value has been returned and take some alternate action?
Thanks, Kevin
Hi,
After getting possible values before accessing the values you can check for the count
sub getp()
set val=ActiveDocument.Fields("F3").GetPossibleValues
if val.Count=0 then msgbox "hi"
for i=0 to val.Count-1
msgbox(val.Item(i).Text)
next
end sub
incase the count is ZERO assing the default mail id.
Cheers.
Or you could fill in blanks in the script with a map....using statement.