Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Some of my documents have "MyDate" variable defined and some dont. I have a code snipped that i posted below that runs for both documents that have the variable and ones that dont. The isnull() is there to test to see if the newdoc.Variables("MyDate") statement actually returned a value. Still, I get an "object required: vbstart" error on this line, "vbstart.SetContent StartDate,true". I know the object does not exist in my document (for my test case) but how do I test for this so I only execute the SetContent if the variable exists? I tried isnull() and also "if vbstart is Nothing then"... Any ideas? Thanks!
ps, I apologize for how the copy and paste from QV script looks. I'll try and fix it up by putting it into notepad or someting...
set vbstart = newdoc.Variables("MyDate")
if not isnull(vbstart) then
vbstart.SetContent StartDate,true
end if
Use a typename() test instead:
set vbstart = newdoc.Variables("MyDate")
If typename(vbstart) = "Variable" then
vbstart.SetContent StartDate,true
end if
-Rob
Use a typename() test instead:
set vbstart = newdoc.Variables("MyDate")
If typename(vbstart) = "Variable" then
vbstart.SetContent StartDate,true
end if
-Rob
Works great. THanks Rob. I was using document.CreateVariable in the meantime but it was a bit of a Kluge.