floyd Posted December 28, 2004 Report Share Posted December 28, 2004 Getting input from a user in Macro Express is done through prompting or picking choices from a menu. It is a linear process. Ask a question. Get an answer. Ask the next question. Get the next answer. And so it goes. For example, if you want to get a user's first name, last name, and email address, you would prompt three different times, once for each bit of information. It would be nice if all three fields could be placed on a single form for the user to fill in but there is nothing in native Macro Express that will allow this. You can, however, use Macro Express to generate and power a multiple-field form built from a script. Here is an example. The form is actually an HTA file, which stands for HTML Application Host. It is essentially a web page without all the baggage and is a feature built directly into Windows. If you look in your system folder you will see a file named mshta.exe, which is used to run HTAs. The attached example macro is self-contained. It is all you need to run the example because it actually generates the HTA file, which in turn writes string variables back to the macro. You only need to import the attached playable (.mxe) file into any Macro Express library (.mex) file. Nothing else is required. There are no external files to deal with. And it cleans up after itself. Any temporary files that are created in your system temp folder are erased before the macro terminates. The example form contains: Text fields Radio buttons Check boxes A drop-down combo box A multiple-pick list Command buttons All of which return the user's choices to Macro Express in the form of string variables. A word about the script. Don't be shy. Take a look at it. It's just a standard HTML document. In fact, if you were to export it out of Macro Express and change the file extension to .htm, it would run in your browser. There is no doubt that you will need to know how to create an HTML document if you want to create a form like this. It isn't that hard to do if you stick with just the basics. That being said, this example goes beyond the basics by using accelerator keys, button handlers, special formatting, and so forth, but I tend to do that when programming. Our clients love it. But Joe ... well never mind. You are free to use this one as a starting point. A word about security. The advantage to using HTAs is that they are run as trusted scripts because they are local and carry none of the security baggage requirements of a web page. It is also the kind of thing that will make some anti-virus software scream and rant and rave and carry-on like nobody's business, about running a script file. If you are concerned that this example macro and script file might contain a virus (they do not), then feel free to scan the playable (.mxe) file before doing anything with it. Peace-of-mind is a wonderful thing. A word about testing. I tested this macro and script using Internet Explorer 6 under Win'XP, Win'2k, and Win'98. I believe (but am not sure) that it will also run under Win'ME and Win'95. If I had, or used, Netscape, Opera, or Firefox I would have tested those also. But I don't. So I didn't. So it goes. MultipleFieldForm.zip Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.