Accessing a form in a another .dot-file?

J

Jean-Guy Marcil

Eric was telling us:
Eric nous racontait que :
Can I access a form in another (global) .dot file somehow?

What do you mean by form (protected form or Userform)?
Can you describe your procedure a bit more?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
E

Eric

Hi!

I have a general form I'd like to put in a dot-file so I can access from
other .dot files. A regular Userform.

/e
 
J

Jean-Guy Marcil

Eric was telling us:
Eric nous racontait que :
Hi!

I have a general form I'd like to put in a dot-file so I can access
from other .dot files. A regular Userform.

If it is stored in a global template, then the easiest is to have a Sub to
instantiate that userform in the global template. Then, just call that Sub
from your other templates. In the calling templates, from the VBA editor,
use the Tool > References menu to set a reference to your global template.

In the global template, have a sub like this:

'_______________________________________
Public Sub CreateForm()

Dim newForm As myFrm

Set newForm = New myFrm

newForm.Show
'do some stuff
Unload newForm

Set newForm = Nothing

End Sub
'_______________________________________

If the global template project is called GlobalTest and the Sub that hold
the code above is called CallForm, then in your other templates, the ones
with the reference to the global one, use a call such as:

GlobalTest.CallForm.CreateForm

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
E

Eric

Ha! Perfect! Many thanks! :)

/e

Jean-Guy Marcil said:
Eric was telling us:
Eric nous racontait que :


If it is stored in a global template, then the easiest is to have a Sub to
instantiate that userform in the global template. Then, just call that Sub
from your other templates. In the calling templates, from the VBA editor,
use the Tool > References menu to set a reference to your global template.

In the global template, have a sub like this:

'_______________________________________
Public Sub CreateForm()

Dim newForm As myFrm

Set newForm = New myFrm

newForm.Show
'do some stuff
Unload newForm

Set newForm = Nothing

End Sub
'_______________________________________

If the global template project is called GlobalTest and the Sub that hold
the code above is called CallForm, then in your other templates, the ones
with the reference to the global one, use a call such as:

GlobalTest.CallForm.CreateForm

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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