+ Reply to Thread
Results 1 to 14 of 14

Userform fade not working from command buttons

  1. #1
    Registered User
    Join Date
    03-30-2011
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    15

    Question Userform fade not working from command buttons

    excel 2003 running xp
    Got a userform that is activated from a command button that fades out the background so the userform really stands out.

    I have about 5 more command buttons on same page but can NOT get them to use the fade routine when their command buttons are pressed.

    kind of got it to work with Buttons but thats not what they require, prefer to use command buttons.

    ' worked with buttons
    Please Login or Register  to view this content.
    Then repeated this for each Button


    Im guessing I need some kind of Class module to see which command button is pressed but stuck

    added example file to look at, any help would be great.
    Attached Files Attached Files
    Last edited by romperstomper; 07-21-2011 at 07:55 AM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,968

    Re: Userform fade not working from command buttons

    Can I ask why you want to use Commandbuttons rather than the more stable Forms buttons?
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    03-30-2011
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Userform fade not working from command buttons

    Because these command buttons are constant throughout the entire project, and you cant apply colour to form buttons.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Userform fade not working from command buttons

    Quote Originally Posted by berty2000 View Post
    Because these command buttons are constant throughout the entire project, and you cant apply colour to form buttons.
    Yes you can.

    I can't see any code to fade out the background or userform
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,968

    Re: Userform fade not working from command buttons

    You could just add a public commandbutton variable to the userform's module and set that in the button_click before you show the form.

  6. #6
    Registered User
    Join Date
    03-30-2011
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Userform fade not working from command buttons

    The code for the fade is all in the example spreadsheet to download.

    Can you colour the buttons in excel 2003 ?

  7. #7
    Registered User
    Join Date
    03-30-2011
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Userform fade not working from command buttons

    Romperstomper can you give a coded example as not up to speed as still learning VB

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,480

    Re: Userform fade not working from command buttons

    code change to command buttons

    Please Login or Register  to view this content.
    Add this to the top of the Userform1 code module, along this the other declarations.

    Please Login or Register  to view this content.
    revise ShowPicture routine
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  9. #9
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,968

    Re: Userform fade not working from command buttons

    Add this to the declarations section in the userform:
    Please Login or Register  to view this content.
    and then refer to Button wherever you need it in the code.

    The ShowDialog code becomes:
    Please Login or Register  to view this content.
    and the button_click:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    03-30-2011
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Userform fade not working from command buttons

    Romperstomper, Starting to look good but im losing the transparency behind the form ?

  11. #11
    Registered User
    Join Date
    03-30-2011
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Userform fade not working from command buttons

    Quote Originally Posted by Andy Pope View Post
    code change to command buttons

    Please Login or Register  to view this content.
    Add this to the top of the Userform1 code module, along this the other declarations.

    Please Login or Register  to view this content.
    revise ShowPicture routine
    Please Login or Register  to view this content.
    When I run this I get "Wrong number of arguments or invalid property assignment" have I missed something obvious.

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,480

    Re: Userform fade not working from command buttons

    I missed out this change in Module15

    Please Login or Register  to view this content.

  13. #13
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,968

    Re: Userform fade not working from command buttons

    For mine, you need to alter the Userform_Activate code to use:
    Please Login or Register  to view this content.
    rather than:
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    03-30-2011
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    15

    Smile Re: Userform fade not working from command buttons

    Quote Originally Posted by romperstomper View Post
    For mine, you need to alter the Userform_Activate code to use:
    Please Login or Register  to view this content.
    rather than:
    Please Login or Register  to view this content.
    That now works a treat, Thank you very much the effect works really well with userforms for me.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1