+ Reply to Thread
Results 1 to 32 of 32

Colour and font size in message popup

  1. #1
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Colour and font size in message popup

    Hi,

    Ive had some great help making a code to force a pop up window to appear when i certain vailue is reaced in a particular row.

    the code is below

    Just wondering if itis possible to change the background colour of the message box (to RED as it is a critical warning) and to enlarge the font size as well



    THE CODE

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 05-24-2013 at 10:29 PM. Reason: Added CODE tags, as per Forum Rules. Take a moment to read the Forum Rules in the menu bar above. Thanks.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Colour and font size in message popup

    No, not in a message box. But add this, should help a little.


    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    G'day. Thanks I will give it a whirl when I get home.

    What should it do??

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Colour and font size in message popup

    You can create a customized userform instead. In that case you can use a specific background, etc.
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  5. #5
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    Ok. I really got heaps of help to do the original.

    Could you please advise how to do the "Userform"?

    Will it still make a popup when the value in colum B triggers?

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Colour and font size in message popup

    Have a look at the attachment. I added the same code, but instead of calling a Msgbox, I called Userform1.

    abousetta
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    Hello,


    ive opened it up to take a look and i am getting an error like this


    COMPILE ERROR
    VAIABLE NOT DEFINED


    Then it opens the VBE and highlights the thrid row in yellow


    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 05-25-2013 at 08:41 AM.

  8. #8
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Colour and font size in message popup

    Can you upload your original workbook so that I can the userform to it? Else drag and drop the userform from the example I gave to your workbook and replace the line in your workbook that begins with Msgbox with the line from my workbook that starts with Userform1.show.

    Also use code tags around your vba code as per forum rules or else you could get a warning from one of the moderators.

  9. #9
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    Quote Originally Posted by abousetta View Post
    Can you upload your original workbook so that I can the userform to it? Else drag and drop the userform from the example I gave to your workbook and replace the line in your workbook that begins with Msgbox with the line from my workbook that starts with Userform1.show.

    Also use code tags around your vba code as per forum rules or else you could get a warning from one of the moderators.


    Hi,

    I'm getting that error using your file that you uploaded

  10. #10
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Colour and font size in message popup

    Here is a simpler example. If macos are enabled, once you open the file, the userform will appear.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    [SOLVED] Colour and font size in message popup

    Gday,

    nope that fixed it... thanks....


    silly question... im trying to add an "OK" or "Close Button on the pop up but cant seem to work it out?
    Last edited by zugfrig; 05-25-2013 at 08:53 AM.

  12. #12
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Colour and font size in message popup

    I added a commandbutton, renamed the caption to "OK", changed the backcolor, and added the code "Unload Me". Therefore, clicking on it will unload (close) the userform.

    There a lot of step by step tutorials on userforms. I find them very useful especially if you don't want people playing with the original worksheet and potentially messing up the formulas, formatting, etc.

    Good luck.

    abousetta
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    Pure Genius...... Thank you very much!

  14. #14
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Colour and font size in message popup

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Thanks.

  15. #15
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    ha ha ha you just scared me... its like your looking over my shoulder... ive clicked the star to thank the helper and have jsut been searching to find how to show as solved.

    apoligies for not using code tags.

  16. #16
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Colour and font size in message popup

    Thanks for the feedback.

    Good luck.

    abousetta

  17. #17
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Colour and font size in message popup

    Hi,

    Replace the code in the userform with this:
    Please Login or Register  to view this content.
    Replace the code in sheet1 with this:
    Please Login or Register  to view this content.
    Put this code at the top of module1:
    Please Login or Register  to view this content.
    What this will do is create a loop so that keep the value of Cell A8 the same until the user clicks OK on the userform. That way, the user can't accidentally keep scanning away without confirming the message on the userform.

    Hope this helps.

    abousetta
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    Hi ,

    just tried that and i get that error again like the other day

    COMPILE ERROR
    Vairable not defined


    with the letter "A" highlighted in grey in the sheet one code and the line starting private sub worksheet highlighted yellow

  19. #19
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Colour and font size in message popup

    Yes, that's because the variable A wasn't originally declared. Replace the declaration "Dim Scan$" with "Dim Scan$, A&".

    abousetta

  20. #20
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    hi abousetta,

    nope ive really messed it up now....

    tired that as above but still an error... i actually attached my latest version this time.

    another issue now since the change is once i fill A8 i cant delete it anymore



    Other Customer Scanning Software fixing pop up.xlsmOther Customer Scanning Software fixing pop up.xlsm

  21. #21
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    whoops, attached it twice, sorry

  22. #22
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Colour and font size in message popup

    Try the attached.... Debugging can be a bit of a trial and error until you pin it all down.

  23. #23
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    Hello again,


    downloaded fine an now no compile error, but, unfortunately, if i scan s barcode when the pop up window is up, the scan closes the window.

  24. #24
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Colour and font size in message popup

    Hi,

    I can't test because I don't use scanners but obviously they can bypass the normal controls that don't allow users to work on the worksheet while the userform is in modal mode. What I have done is put in an If statement that should trigger Cell A8 to go back to the original value until you click OK on the userform. Hopefully the tweaks work this time around.

    abousetta
    Last edited by abousetta; 05-27-2013 at 09:03 AM.

  25. #25
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    Hi,

    Unfortunately no... this is probably going to be near impossible to test given i am using a scanner and you arent.

    it actually happens so fast in that i pull the trigger and the barcode populates and the cursor jumps to the next cell a split second be for colum B turns red and the popup appears.


    after the pop up appears it is almost like pulling the trigger has the same effect as pressing enter on the key board

  26. #26
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Colour and font size in message popup

    Let me ask around... maybe someone has a scanner and debug this. I'm trying to imagine in my head the process but without being able at to debug we could be doing this for a while.

  27. #27
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    No Worries,

    appreciate all your help...

    i could video tape the procees if that helps?

  28. #28
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Colour and font size in message popup

    The box closes since a barcode scanner puts a carriage return at the end of the input (the same as pressing return). All a barcode reader does essentially is manually type the number an press enter, you can replicate it by doing just that. Pressing return presses the command button on the form which closes it (since buttons take focus).

    One way of resolving the issue would be to replace the button with a label

  29. #29
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    Hello, and welcome to my nightmare :-)

    So basically you are saying get rid of the button and just use the X in the corner to close the popup???

  30. #30
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Colour and font size in message popup

    No, I'm saying create a label with the caption that's on your button. Double click it and paste the code that's behind the button, then remove the button.

    You can then click the label as you would a button, that will do the same as the button did, but the barcode scanner won't close it

  31. #31
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Colour and font size in message popup

    Thanks Kyle. I didn't know that scanner hit the return button, but can see the logic behind that. Attached is an example replacing the button with a label.

  32. #32
    Registered User
    Join Date
    06-03-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Colour and font size in message popup

    Many, many, thanks to you both>>>> well done

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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