• dialogstyle not working

    Author
    Topic
    #496011

    What worked just fine in 2003 is now causing a problem in 2010. The code reads…

    dialogstyle = vbQuestion + vbYesNo + vbDefaultButton2

    Now gives me the error message of…

    “Compile error:

    Variable not defined.”

    What do I need to do now to get this to work?

    DennisK

    Viewing 3 reply threads
    Author
    Replies
    • #1464349

      Dennis,

      Your 2010 probably has the “Require Variable Declaration” ( Optioin Expicit ) 37658-vbeoption checked in the VBE. Look at the top of your module and you’ll see it there.

      Just add: Dim dialogstyle as Integer

      That should get you going. HTH :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1464350

      That was not checked BUT… in planning for the future, I had placed “Option Explicit” in the code. Once I commented that out all seems to work just fine. Thanx SO much for pointing me in the right direction.

      Dennis

    • #1464358

      Dennis,

      Please consider checking that option and always declaring your variables. It makes finding things like incorrectly spelled variables much easier. True it is a little more painful up front to remember to add the declaration each time you need a new variable but in the long run it will be well worth it. As one of my old mentors used to point out “There is never enough time to do things right…but always enough time to fix them later”, he said dripping with sarcasm! :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1464360

      I wholeheartedly second RetiredGeek’s comments about Option Explicit.

      Steve

    Viewing 3 reply threads
    Reply To: dialogstyle not working

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: