Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2005

Tip: Looking for answers? Try searching our database.

This works in all templates except Normal

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Phil - 23 Nov 2005 12:35 GMT
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
Dawn Crosier - 28 Nov 2005 20:34 GMT
It is typically not necessary to declare a UserForm.

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

Should work for you.

Signature

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
Charles Kenyon - 28 Nov 2005 20:54 GMT
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.
Signature

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

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
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.

> It is typically not necessary to declare a UserForm.
>
[quoted text clipped - 22 lines]
>
> Philip
Doug Robbins - Word MVP - 28 Nov 2005 21:22 GMT
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

Signature

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

> It is typically not necessary to declare a UserForm.
>
[quoted text clipped - 22 lines]
>
> Philip
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.