+ Reply to Thread
Results 1 to 27 of 27

Hide the X Close Button - Change in direction..

  1. #1
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Hide the X Close Button - Change in direction..

    Hello Everyone...

    I have a Userform that Auto Launches and is only visible for 10 seconds and Auto Closes ... I am using as a splash...

    I would like to know if it is possible to hide the Caption and or X Close button because I need neither because it closes on it's own???



    Best Regards,

    John
    Last edited by JJFletcher; 05-11-2016 at 12:02 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,912

    Re: Captionless or Hide the X Close Button on Userform ???

    Open the properties for the UserForm. You should be able to delete the Caption. I don't see any place in the properties to remove the X, however, look at this link

    http://www.ozgrid.com/VBA/userform-close.htm

    http://www.ozgrid.com/forum/showthread.php?t=40648
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Captionless or Hide the X Close Button on Userform ???

    Hi Alan,

    Thank you for your suggestion.. Unfortunately this will not provide the solution... the Caption and X still remain visible...

    The need to hide the Caption and X close button are for my Progress Bar - because the userform auto closes in 10 seconds there is no need for the caption or the X Close button...

    Here is my Code for the Progress Bar:

    Please Login or Register  to view this content.

    Best Regards

    John

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Captionless or Hide the X Close Button on Userform ???

    Put the following code in standard module
    Please Login or Register  to view this content.
    And in userform module put the following
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  5. #5
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Captionless or Hide the X Close Button on Userform ???

    Hi Yasser,

    Good to see you again...

    I tried to use the suggested code and got this error:

    error1.JPG

    Best Regards,

    John

  6. #6
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Captionless or Hide the X Close Button on Userform ???

    Tried this modification but got the following:

    error2.JPG

    Best Regards,

    John

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,912

    Re: Captionless or Hide the X Close Button on Userform ???


  8. #8
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Captionless or Hide the X Close Button on Userform ???

    Hi Alan,

    Modified the code with the suggestion - No change...

    Please Login or Register  to view this content.
    Best Regards,

    John
    Last edited by JJFletcher; 05-08-2016 at 02:40 PM. Reason: Code Correction

  9. #9
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Captionless or Hide the X Close Button on Userform ???

    I found this code but get the following error: Regarding FindWindow

    error3.JPG


    John

  10. #10
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Captionless or Hide the X Close Button on Userform ???

    What if we were able to modify the vbFormControlMenu in the Macro...

    Please Login or Register  to view this content.
    Is there a way to rewrite this so Cancel = True could be replaced somehow with Visible = False..... I tried this but it failed...

    Best Regards,

    John
    Last edited by JJFletcher; 05-08-2016 at 06:12 PM. Reason: grammer

  11. #11
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,912

    Re: Hide the X Close Button - Change in direction..

    crossposted: http://www.mrexcel.com/forum/excel-q...ml#post4515434

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

  12. #12
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Hide the X Close Button - Change in direction..

    Hello all....

    I forgot about rule 8 - I was not getting any response from The Forum on the last question so thought I would address regarding changing the color in another Forum...

    Sorry for the mix-up

    Best Regards,

    John

  13. #13
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Hide the X Close Button - Change in direction..

    Look at following link to correct function declarations to work on 64-bit systems.
    http://www.jkp-ads.com/Articles/apideclarations.asp

  14. #14
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Hide the X Close Button - Change in direction..

    Thanks Bakerman2,

    I will try to digest this information and see if I can get the code to cooperate.

    Best Regards,

    John

  15. #15
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Hide the X Close Button - Change in direction..

    Remember you'll need conditional compilation if you want the code to run on both 32 and 64 bit Office.

    Also worth telling people upfront if you're using 64bit Office - it's still relatively rare and will affect any API code as well as what controls you can use in your projects.

  16. #16
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Hide the X Close Button - Change in direction..

    also the version of excel matters as well

    http://www.ozgrid.com/forum/showthread.php?t=85960
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  17. #17
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Hide the X Close Button - Change in direction..

    Hello Everyone,

    When applying the changes - This is the first error received... the highlighted "Blue" - FindWindow is the first error.....

    error4.JPG

    Here is the current code

    Please Login or Register  to view this content.
    Best Regards,

    John
    Last edited by JJFletcher; 05-09-2016 at 07:33 AM. Reason: corrected code

  18. #18
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Hide the X Close Button - Change in direction..

    Maybe like this.
    Please Login or Register  to view this content.

  19. #19
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Hide the X Close Button - Change in direction..

    Unfortunately this did not work.


    Any other thoughts?

    John

  20. #20
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Hide the X Close Button - Change in direction..

    I'm really flying blind here since I can't test anything but let's start wit something simple.
    Straightforward not too much code in it.
    Example file should open userform with no frame on top.
    Attached Files Attached Files

  21. #21
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Hide the X Close Button - Change in direction..

    running the code i get error in SetWindowLong so i changed it to SetWindowlongPtr instead

    Please Login or Register  to view this content.
    then second issue i got was about missing Dll entry point

    to get around that i changed
    this line
    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    after that it works on my system

    agree with baker, very hard to test code without having the same system setup
    Attached Files Attached Files
    Last edited by humdingaling; 05-10-2016 at 02:38 AM. Reason: running 32 bit Excel on 64 bit windows 7

  22. #22
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Hide the X Close Button - Change in direction..

    Hi humdingaling and Backerman,

    I have attempted to utilize the code but something is not right...

    Here is the upload... Going to work - will check back this afternoon!

    Best Regards,

    John
    Attached Files Attached Files
    Last edited by JJFletcher; 05-10-2016 at 08:05 AM.

  23. #23
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Hide the X Close Button - Change in direction..

    First remove all code from Splash sheet module except for commandbutton.
    Try again.
    On which line are you getting the error ?

  24. #24
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Hide the X Close Button - Change in direction..

    you cant really mix and match the way you are trying to do
    stick to one method until the API bit is sorted out
    as such going with baker's method (as it is much easier to manage). This method is basically taking the menubar away (from what i can tell)

    on your "Main"
    if you have a caption on the userform it will bring the X back
    i commented out the caption

    Please Login or Register  to view this content.
    deleted whatever was in Initialize2 (this does not work with 2) and added it to just one initialization

    Please Login or Register  to view this content.
    Attached Files Attached Files

  25. #25
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Hide the X Close Button - Change in direction..

    Hi humdingaling and Backerman,

    2 days trying to figure this out and you guys did it...

    That did it... Fantastic results and it works

    Best Regards,

    John

  26. #26
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Hide the X Close Button - Change in direction..

    glad it worked out in the end

    credit goes to bakerman for the source, i just help you debug it to work on your system

  27. #27
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Hide the X Close Button - Change in direction..

    @ JJFletcher

    Good for you.

    @ humdingaling

    Thanks for kind words and of course the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 01-31-2016, 05:54 AM
  2. [SOLVED] Use API to disable or hide the Close Button or Caption Bar on UserForms
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-25-2014, 09:33 PM
  3. Hide or disable the 'Close' button
    By 5631 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-18-2008, 12:36 PM
  4. Hide/Erase the "X" Close Button on UserForm
    By Mike2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-26-2008, 01:48 PM
  5. Hide red close button
    By masanovic1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-01-2008, 07:07 AM
  6. Userform + close button
    By Chip Smith in forum Excel General
    Replies: 2
    Last Post: 04-01-2006, 04:40 AM
  7. Userform close button
    By Les Stout in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2005, 02:45 PM

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