View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
DennisE DennisE is offline
external usenet poster
 
Posts: 66
Default Control Order on User Form

Allan,

Excel stores the conrols contained in
a UserForm in a random order that has
nothing to do with their alphanumeric
name or Tabindex. The trick is therefore
to assign them names CheckBox01 through CheckBox50, reflecting the order
you would like to print them out in. Then
to print them to sequential file#1, say, do the following:

Dim K as Variant
For K = 1 to 50
Print#1, PrintControlForm.Controls("CheckBox" & Format(K, "00").Value
Next

You can use the above method for
printing the contents of any collection of same-type controls, by replacing,
for example, "CheckBox" by "TextBox" and remembering to change .Value to .Text.
The method works like a charm.

-- Dennis Eisen