View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Help using TextBox Value

ctl.Text is showing <Object doesn't support this property or method and
ctl.value is showing 3

Something is wrong. And I don't know what it is. I can't open any of the
files if I keep getting this. Is there any other way you can help.

"Tom Ogilvy" wrote:

should work - since you only hide the form, it should stay loaded and the
values of the textbox are maintained and accessible. Try making these
changes

Dim ctl as Control
For Each ctl In frmOpenFiles.Controls
If typeof ctl is msforms.TextBox Then
If lcase(Right(Trim(ctl.Text), 4)) = ".xls" Then
Workbooks.Open Filename:=ctl.Value
End If
end if
Next

--
Regards.
Tom Ogilvy

--
Regards,
Tom Ogilvy

"Ayo" wrote:

Hi,
I craeted a UserForm with 5 buttons and 5 texboxes. I entered values
into the textboxes then I hid it and opened another form using:
Me.Hide
frmSaveTo.Show

This new userform also has buttons and a textbox on it. Now I need to use
the values that were entered in the former userform textboxes at this stage.
That is where I am running into a problem. I was using the following snippet
of code to get the value (or text) from the former userform textboxes:
For Each ctl In frmOpenFiles.Controls
If TypeName(ctl) = "TextBox" Then
If Right(ctl.Text, 4) = ".xls" Then
Workbooks.Open Filename:=ctl.Value
End If
But I don't think it is working right.
How do I get the values (or text) from the first userform to use later in
the code, even though I hide the form?