Microsoft Office Tutorials and References
In Depth Information
19.6.2.3 Tab Order
optEmpty
cmdSelect
cmdCancel
cmdUndo
cmdCompleteRows
cmdCompleteColumns
lblSearchRange
You will not need to set many control properties beyond the Name property and the Accelerator
property (indicated for each control in Figure 19-30 b y an underscore in its caption). Be sure to set
the WordWrap property of the lblSearchRange label to False so that the label will occupy
only a single line. Also, set the TabStop property of lblSearchRange to False .
19.6.2.3 Tab Order
It is important whenever designing a custom dialog to set the tab order of all controls properly.
There is nothing less professional than having the focus jump around randomly when the user
repeatedly hits the Tab key! The simplest way to set the correct tab order is to use the Tab Order
dialog box, available from the View menu and shown in Figure 19-31 . You can use this dialog to
get an overall view of the current tab order and to change that order, if desired. Remember that the
control with tab order 0 will receive the focus when the dialog is first displayed. You will need to
display the Tab Order dialog twice: once while the entire dialog is selected and once while the
frame control is selected (to see the tab orders of the option buttons).
Figure 19-31. The Tab Order dialog
19.6.2.4 Some final tips
We should remark that the VB editor's Format menu has some very useful items for aligning and
resizing controls on a UserForm to give your forms a more professional look. You should
definitely do some exploration of this menu. Another useful trick is to copy and paste controls.
This produces controls of identical size and preserves other properties as well. (Of course, some
properties, such as the Name property or the position properties, are not preserved.)
19.6.3 Writing the Code
Now that the dialog is created, we can start writing the code.
In the basMain standard module, place the code that displays the Select Special dialog box.
However, it is possible that the current selection in the active worksheet is not a collection of cells.
It could be a drawing object or chart, for instance. In this case, we want to issue a message stating
 
Search JabSto ::




Custom Search