Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default convert object name from string to object

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default convert object name from string to object

Hi Vergel,

Thanx a lot for your fast response, your solution works!

kind regards

Tamar

"Vergel Adriano" wrote:

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


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
calling a method on a object that you know the string name for. scotty[_2_] Excel Programming 1 January 12th 07 02:49 PM
Using a string to set an object reference? Jeremy Excel Programming 2 January 3rd 07 02:02 PM
Confusion about how the Window object fits into the Excel object model Josh Sale Excel Programming 11 April 15th 05 06:08 PM
a string object Daniel[_4_] Excel Programming 3 December 31st 03 10:10 PM
Using a string to point to a form object? plumbye Excel Programming 1 September 8th 03 06:49 PM


All times are GMT +1. The time now is 06:26 PM.

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

About Us

"It's about Microsoft Excel"