How to create GUI from text-only code?

B

Blake

Greetings from beautiful Tucson, AZ,

Question: Is it possible to create a GUI/form/etc. in VBA strictly
through text code (meaning the GUI is "built" WITH text commands
specifying control properties/methods and WITHOUT the graphical tool
that lets you select GUI components and drag-and-drop them on a
template)?

Why I ask: I cut my GUI-design-programming teeth in Matlab (by
MathWorks), in which you could build a GUI either (A) through their
graphical GUI design editor (similar to VBA's drag-and-drop tool) OR
(B) by building the GUI entirely through code commands (specifically,
a "uicontrol" command that specified each control's general methods/
properties). I prefer this second option for GUI design due to
portability/openness/drag'n'drop-hurts-my-wrist/etc.

Other options I am aware of: I am aware of the variety of standard
dialogs available in VBA; I'm seeking to create my own personalized
GUI's with text commands and without all the mousework. I am aware of
work-arounds involving other GUI tools (I've had Word call programs
built in Python's Tkinter).

Thanks for your time in reading and any potential help you can provide.
 
C

Cindy M.

Hi Blake,
Question: Is it possible to create a GUI/form/etc. in VBA strictly
through text code (meaning the GUI is "built" WITH text commands
specifying control properties/methods and WITHOUT the graphical tool
that lets you select GUI components and drag-and-drop them on a
template)?
Not in the way you outline, unless you create an old WordBasic "form".
That was completely command-defined.

It is possible to generate a form using only code, but it's a bit
complicated as it only really exists at run-time. In addition, the
Macro Security option to allow access to the VB projects must be
enabled (which is something the user controls, not the developer). You
need the Visual Basic Extensibility (VBE) library (as in
ActiveDocument.VBProject).

Here are a couple of KB articles that illustrate the principle

http://support.microsoft.com/kb/185774/en-us
http://support.microsoft.com/kb/204330/en-us

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top