Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default An Interesting Excel UserForm Question

I have a UserForm on which I've placed a great many TextBoxes
named TextBox01 through TextBox50, with Tabindex 0 through 49,
respectively. I now want to write their contents to a file and have
written the following real simple code after opening a sequential file:

Dim ctl as Control
For Each ctl in UserForm.Controls
if Typename(ctl) = "TextBox" then Print #1, ctl.Text
Next
Close #1

What happens, however, is that the resultant file contains the
contents of TextBoxes in a seemingly random order, which
has no relationship to the alphanumeric ordering of the TextBox
names or their respective Tabindexes. When I pull up the list
of controls using Project Explorer, they all appear in proper
alphanumeric order. My immediate work-around has been
to modify the above procedure to extract the right two characters
of the control name and use these as a subscript for a one-
dimensional array to temporarily store the data, and then to
print the temporary file in sequential order. My question is,
is there a way to force Excel to inherently reference the
TextBoxes so that I do not have to resort to messy code
and have the simple version above do the job?

-- Dennis Eisen
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform question Brad Excel Discussion (Misc queries) 4 March 15th 10 04:43 PM
An Interesting vba Excel quirk GeorgeJ Excel Discussion (Misc queries) 7 August 14th 07 02:11 AM
an interesting Excel question jaccker Excel Discussion (Misc queries) 2 April 3rd 06 04:21 PM
Interesting Counting Question...HELP onesidered Excel Discussion (Misc queries) 9 August 8th 05 07:27 PM
interesting question can anyone help short_n_curly Excel Discussion (Misc queries) 3 July 20th 05 09:02 PM


All times are GMT +1. The time now is 07:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"