Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling close button 4

Status
Not open for further replies.

WoundEdGoat

Programmer
May 10, 2002
39
0
0
CA
Can someone tell me how to disable the close button on a form and still have the use of the minimize button?
 
As a starting vba-programmer, with some old basic-programming background, I can't understand why the solutions as set hereabove are not working for me.

Both solutions as given by rorubin and ADoozer returned errors

I've tried both solutions separate from another first in the userform code and later in a separate module with the activation-command 'DisableX Me' in Userform_activate and the deactivation-command 'EnableX Me' in the commandbutton_click code which closes the form

in case of rorubin I got the error on :
'Public Function DisableX(frm As Form)'
in case of Adoozer I got the eroor on :
'Private Function EnableX(frm As Form)'

all the times the error message read:
'Compile error'
'a by user defined variable-type is not defined'

pardon the translation-errors)

Since all types are declared the only answer I could think of was that the code was placed wrong therefor I tried the different locations. This didn't resolve it. Now I am thinking that I placed the call 'En/DisableX Me' wrong but I can't think of an answer.

In good order, I'm working with a p4, 2.6, with xp-pro, sp2 and office2000 vba.

Please advise,
thnx in advance

 
littlewoman - If you use the code posted by ADoozer on '5 May 03 12:36' with the two command buttons on a regular form it does work (though it's a bit hit and miss when not used in VB) in VBA. I removed all refernces except Visual Basic for Applications and it still ran error free.
It might be more beneficial for you to post this query in the VBA forum - forum707

Hope this helps

Harleyquinn

---------------------------------
For tsunami relief donations
 
This faq702-1870 is worth to look

________________________________________
Zameer Abdulla
Visit Me
The best thing to spend on your child is your time.
 
Harleyquinn:
thnx for your answer, strange it remains that it works but not overhere. The only thing I can think of now is that you removed the vb-code and here it is still within because I can't tell the difference and therefor it works for you with vba. While trying it with vb code in it, your vb kicks in and here it can't.

ZmrAbdulla:
This is a access2000-faq and yes, there it is relatively simple to deactivate the closebutton.
It's my mistake. I didn't mention I was working with Excel2000 in this case. I tried it anyway as far as it applies but it also didn't work.

Oh well, back to the drawingboard :))))
Thnx for the efforts and the quick response, gentlemen

 
It is my mistake assume that I am in Access forum. I never use glasses. But I need glasses of concentration. Sorry...
There are some samples in "PSCODE". Please see the links
Disable 'X' on Forms (Including MDI Child Forms)
Disable Close Button

________________________________________
Zameer Abdulla
Visit Me
The best thing to spend on your child is your time.
 
hahahahaha
now I understand as well what you meant with 'regular form', since excel only has 1 type of form the userform I couldn't grasp it. Thought it was some type of vb-thing.

lol

a day not laughed is a day not lived, well I'm alive today thnx to my own stupidity :)
 
Yeah Harleyquinn, I know it is VB6 code. I have just forwarded another VB6 code as they(littlewoman) are trying VB6 code in Excel. May be the API call can help them.

________________________________________
Zameer Abdulla
Visit Me
The best thing to spend on your child is your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top