How to display a form

B

BRC

Using Win2k, Word 2k
I have a form i am try to display at a certain point in a document. I
thought a simple macro with
Sub show_frm ()
Myform.show
end sub
would cause the form to open, however i am getting an "object
required" object required error message. this same method works in
other templates i have. can anyone help
Thanks BRC
 
C

Charles Kenyon

Does MyForm exist in your template?

Better practice is to not use the show command but to create a new instance
of the form. The following is from a template which has a frmAddress that I
want to use:

Dim myForm As frmAddress
Set myForm = New frmAddress
myForm.Show
Unload myForm
Set myForm = Nothing


--
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.
 
J

Jezebel

The message means either that VBA doesn't know what "Myform" refers to, or
there is a bug in the form's initialisation code. a) Is the macro in the
same template as the form? b) What line is highlighted as throwing the
error?
 
J

Jezebel

Agree entirely. An even simpler way to code it is --

With New frmAddress
.Show
.Unload
End With
 
B

BRC

Thank you all, the problem was that the form was not in the same
template as the macro. It's displaying as it should. I used the code
that Charles outlined above. thanks again.
BRC
 
C

Charles Kenyon

Thank you for the tip.
--
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.
 

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