Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default exit form and close sheet

I have a command button on a form that checks a password, if OK, it opens a
sheet. If I use the X on the top corner to close the form it opens the sheet
without checking the password. How do I close the sheet if the form is
exited. Thanks for the help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default exit form and close sheet

I'm sorry, I'm a self taught rank amature at this. I don't understand your
suggestion. Can you give me some sample code please?
Thanks
Doug

"Sam Wilson" wrote:

Declare a public boolean variable and set it to false in your code before you
show the form.

Include a line setting the value of this variable to True when OK is clicked

back in the code that called the form, include a line to close the sheet if
the boolean variable is false.

"Doug" wrote:

I have a command button on a form that checks a password, if OK, it opens a
sheet. If I use the X on the top corner to close the form it opens the sheet
without checking the password. How do I close the sheet if the form is
exited. Thanks for the help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default exit form and close sheet

Your existing code must somewhere have an instruction to show the form,
something like

MyForm.show

What you need to do is put the lines

dim bCanc as boolean
bcanc = false

Once the password has been checked and is valid, put the line

bcanc = True

in your code. Then finally, after the line MyForm.Show you need to put

if bcanc = false then exit sub

Sam



"Doug" wrote:

I'm sorry, I'm a self taught rank amature at this. I don't understand your
suggestion. Can you give me some sample code please?
Thanks
Doug

"Sam Wilson" wrote:

Declare a public boolean variable and set it to false in your code before you
show the form.

Include a line setting the value of this variable to True when OK is clicked

back in the code that called the form, include a line to close the sheet if
the boolean variable is false.

"Doug" wrote:

I have a command button on a form that checks a password, if OK, it opens a
sheet. If I use the X on the top corner to close the form it opens the sheet
without checking the password. How do I close the sheet if the form is
exited. Thanks for the help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default exit form and close sheet

Great! Thanks for the extra info, it helps a lot.
Thanks
Doug

"Sam Wilson" wrote:

Your existing code must somewhere have an instruction to show the form,
something like

MyForm.show

What you need to do is put the lines

dim bCanc as boolean
bcanc = false

Once the password has been checked and is valid, put the line

bcanc = True

in your code. Then finally, after the line MyForm.Show you need to put

if bcanc = false then exit sub

Sam



"Doug" wrote:

I'm sorry, I'm a self taught rank amature at this. I don't understand your
suggestion. Can you give me some sample code please?
Thanks
Doug

"Sam Wilson" wrote:

Declare a public boolean variable and set it to false in your code before you
show the form.

Include a line setting the value of this variable to True when OK is clicked

back in the code that called the form, include a line to close the sheet if
the boolean variable is false.

"Doug" wrote:

I have a command button on a form that checks a password, if OK, it opens a
sheet. If I use the X on the top corner to close the form it opens the sheet
without checking the password. How do I close the sheet if the form is
exited. Thanks for the help.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
exit form and close sheet Sam Wilson Excel Programming 0 May 27th 09 05:20 PM
Ecape key to close/exit sheet count Excel Programming 2 March 31st 09 03:50 PM
Close and Exit Excel MikeWaldron Excel Programming 0 September 8th 03 05:31 PM
Close and Exit Excel Stephan Kassanke Excel Programming 3 September 8th 03 05:30 PM
Close or Exit application Jeff[_20_] Excel Programming 0 September 8th 03 03:18 PM


All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"