Help with new form instance coding please.

T

ThomasAJ

I use a variation of the following code for each form that I want to be able
to create a new instance thereof. It works fine.

However I want to be able to use ONLY ONE procedure and feed in the form
name as a variable and then use it in line 70 thus:
Set frm = New frmVariable

Nothing I tried works. It seems that 'Set frm = New ????' requires a form
name and not a variable.

Sub NewGraph1()
Dim frm As Form
'New instance
70 Set frm = New Form_Graph1
71 frm.Visible = True
' The Key value must be a string, so tack on a
' null string to force the conversion. You'll
' use the hWnd later when you try and
' remove the window from the collection of windows.
72 colForms.Add Item:=frm, Key:=frm.hWnd & ""
125 Set frm = Nothing
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top