This works in all templates except Normal

P

Phil

Hi Folks,
Can anyone please tell me what I need to do to make this work in my normal
template? The UserForm is located in the normal template together with the
follwing code; but I get:
"Run Time Error 5. Invalid Procedure Call or Argument"

Public Sub Test1()
Dim frmU1 As New UserForm1
Load frmU1
frmU1.Show
End Sub

TIA

Philip
 
D

Dawn Crosier

It is typically not necessary to declare a UserForm.

Public Sub Test1()
Load frmU1
frmU1.Show
End Sub

Should work for you.

--
Dawn Crosier
Microsoft MVP
"Education Lasts a Lifetime"

This message is posted to a newsgroup. Please post replies and
questions to the newsgroup so that others can learn as well.

Hi Folks,
Can anyone please tell me what I need to do to make this work in
my normal
template? The UserForm is located in the normal template together
with the
follwing code; but I get:
"Run Time Error 5. Invalid Procedure Call or Argument"

Public Sub Test1()
Dim frmU1 As New UserForm1
Load frmU1
frmU1.Show
End Sub

TIA

Philip
 
C

Charles Kenyon

This gets us into the discussion of magic forms, which is way over my head.
When you load a form directly rather than creating a new instance of it, you
run into problems if the form is being loaded multiple times in a single
Word session, is my understanding.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
D

Doug Robbins - Word MVP

Or even load it.

But I believe that the syntax that the OP should be using is:

Dim frmU1 As UserForm1
Set frmU1 = New UserForm1
frmU1.Show



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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