cannot hide userform

H

Haroon

Hi,

i want to hide the userform when ok button is pressed and all the code
processed.

i added this code at the end of OK button

me.hide

it gives 'Run-Time error '4198':
Command failed'

that comes up when i open the template containing the form, but if i run the
form again from the VBA editor, it hides it, but not opening the document for
the first time.

anyone got any idea?

cheers.
 
R

R.J. van Dam

Perhaps this will help:

Private sub <whatever>()
......
Unload Me
End Sub

CU

RJ
 
H

Haroon

nope dont work when i load the document for the first time,

however, if i close the form, and run the form again from the VBA editor, it
works fine.
 
D

Doug Robbins - Word MVP

Are you sure that it is that particular line of code that is causing the
problem and not something before it?

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