I tried to see if a var already exists in the main or calling program. The function should be in an include. If the var was already globally declared in the calling program then a dim would give an error. To prevent this i was trying to only dim the var if it didn't exist yet.