Results 1 to 2 of 2
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Basingstoke, Hampshire, United Kingdom
    Thanked 0 Times in 0 Posts

    Variable variables (WinNT4, Word97)

    I think I've posted more questions in the last couple of weeks than in the whole of the rest of the time I've been a lounger! So here's another one - hopefully it's just something silly I'm doing wrong and has a simple answer.

    A template I'm working on has a userform on the front, one of the fields of which has a dropdown list. Some of the options on this list prompt an extra query, the answer to which is held in a variable. My problem is, if I declare the variable in the form's code, it forgets the answer when it goes back to the ThisDocument code, but if I declare it in ThisDocument, the form says the variable has not been declared. I've tried dimming it normally and putting it in as 'Public deptSpecific as string' in both places.

    How do I get the variable to remember it's value from the form to the main code, please?
    Beryl M

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Variable variables (WinNT4, Word97)

    I think this came up in <post#=190768>post 190768</post#> too - you must put all public declarations and code in a standard module (the type you create by selecting Insert/Module in the VBE). Both ThisDocument and form modules are class modules.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts