End IfIn the next section we will show you all of the options available to you when creating message boxes. Then we will introduce you to the syntax of the MsgBox Function and finally go over other message box examples.
VBA Message Box OptionsTake a look at the image below. Here you will see (almost) all of the options available to you when creating message boxes. Take notice of the icons and the different buttons.This is a screenshot of the “MessageBox Builder” from our Premium. The MessageBox Builder allows you to quickly design your desired messagebox and insert the code into your code module.
To display message boxes in VBScript you have to use Msgbox function, if you want to display Yes or No buttons you need to pass additional parameters to the function. Note: Msgbox is not supported on ClearQuest Web servers and can cause the server to hang. Here is a simple VBScript example.
It also contains many other code builders, an extensive VBA code library, and an assortment of coding tools. It’s a must-have for any VBA developer. Syntax of MsgBox FunctionMsgBox( prompt , buttons , title , helpfile, context )prompt (Required) – This is the primary message box text.buttons – Choose which buttons to display. If omitted, ‘OKonly’.
Here you can also specify what icon to show and the default button.title – The title at the top of the message box. If omitted, the name of the current application is displayed (ex. Microsoft Excel).helpfile – Specify help file that can be accessed when user clicks on the ‘Help’ button. If specified, then you must also add context (below)context – Numeric expression representing the Help context number assigned to the appropriate Help topic.You can probably ignore the helpfile and context arguments.
I’ve never seen them used. Customize Message Box Title and PromptThe MsgBox function allows you to customize the title and prompt messages like so.
For this next bit, it's fairly simple, because I do all the work. X=msgbox('Your Text Here',0, 'Your Title Here') Make sure that the ' is included in the text and replace the Your Text Here and Your Title Here.
But don't change anything elese! Thank you for taking the time to reply. I'm an extreme novice with this stuff, but don't think this is what I was looking for. Let me know if I'm mistaken: - I copied/pasted everything you put into Notepad and saved as a.vbs file. Then when I click on that file, it asks if I want to open the Windows folder (and gives me a yes or no options). When I click 'yes' it opens the folder C:/Windows.
This all sounds like how the example was designed to work. However, what I was hoping for was a way to show a pop up message WHEN I CLICK ON A FOLDER. An example would be if when I click on a 'Pictures' folder I created, I want a pop up box to trigger and say something like 'Reminder:' and 'Remember to put new pictures on external hard drive' and then just have an 'OK' option. That way, I'll remember to save my pics to my external hard drive every time I click on the 'Pictures' folder. This is just an example, I really want to use if for work where I have customer's folders that contact past proposals, reports, documents.and a few of them require certain things like 'must include sales tax on proposals,' or 'This customer has 10% Discount on all orders' - so I want everyone in my company to see these kinds of reminders when clicking on their folders in Windows Explorer.
It sounds like what I want is the other way around from what you said, so while your way lets me click on the VBS file, then click yes to open the example folder, my hope is to swap that around (click on a folder and then have a pop-up box show up to remind me certain things). Maybe some minor tweaking is what is needed. Thanks again and if you have an answer to my follow up question, please let me know. Appreciate your help. Set WshShell=CreateObject('WScript.Shell')X=WshShell.run('cmd /c explorer.exe ',0, true)Y=msgbox('Remember to put new pictures on external hard drive',0+64,'Reminder:')That should be what you are looking for. Make a shortcut on your desktop, move the vbs file into the C: drive, right-click the shortcut, click properties, if not already, go to the 'Shortcut' tab, click Change Icon., find the icon that matches your pictures icon in the File Explorer and click on it, press OK, on the 'Properties' menu press Apply, then press OK.I hope this is what you wanted.-Marshal.