View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vergel Adriano Vergel Adriano is offline
external usenet poster
 
Posts: 857
Default convert object name from string to object

Tamar,

Try it this way:

For i = 1 To 22
CheckFrame Me.Controls("FrameQ" & i)
Next i


--
Hope that helps.

Vergel Adriano


"Tamar" wrote:

Hi can anybody help me with this problem:

I have a function that expects the following:

Public Sub CheckFrame(ByRef ThisFrame As MSForms.Frame)

I would like to call this Sub in a loop foor frames with names FrameQ1,
FrameQ2 untill 22.

so:

for i = 1 to 22
CheckFrame Cstr("Me.FrameQ" & i)
next i

but this doesn't work because the sub expects a frame object and not a
string. But how can i change string such that the sub will treat it as the
Frame object?

I really hope you can help me out here...

kind regards,

Tamar