ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to "Quit"....Input Box (https://www.excelbanter.com/excel-programming/405346-how-quit-input-box.html)

CLR

How to "Quit"....Input Box
 
Hi All.........

k = InputBox("Enter Lastname, Firstname")

I have the above line in my macro, and once the box appears on the screen,
there is no way to QUIT the program............how do I add a "QUIT" button
to the box, please?

TIA
Vaya con Dios,
Chuck, CABGx3




Dave Peterson

How to "Quit"....Input Box
 
You can't change that inputbox, but you could do something like:

dim k as string
k = inputbox(prompt:="...")
if trim(k)="" then
exit sub
end if

'keep going...

CLR wrote:

Hi All.........

k = InputBox("Enter Lastname, Firstname")

I have the above line in my macro, and once the box appears on the screen,
there is no way to QUIT the program............how do I add a "QUIT" button
to the box, please?

TIA
Vaya con Dios,
Chuck, CABGx3


--

Dave Peterson

CLR

How to "Quit"....Input Box
 
Okey doke...............that's some help, thanks much Dave......

Vaya con Dios,
Chuck, CABGx3


"Dave Peterson" wrote in message
...
You can't change that inputbox, but you could do something like:

dim k as string
k = inputbox(prompt:="...")
if trim(k)="" then
exit sub
end if

'keep going...

CLR wrote:

Hi All.........

k = InputBox("Enter Lastname, Firstname")

I have the above line in my macro, and once the box appears on the

screen,
there is no way to QUIT the program............how do I add a "QUIT"

button
to the box, please?

TIA
Vaya con Dios,
Chuck, CABGx3


--

Dave Peterson




JLGWhiz

How to "Quit"....Input Box
 
If you really want to quit the program, you can use the Cancel button with
this code:

If k = "" Or k = False Then
ThisWorkbook.Saved = True
Application.Quit
End If

A word of caution! If you have other workbooks open, this will affect them.
It also closes without saving anything in the ThisWorkbook sheets that may
have been added or changed during this session.

"CLR" wrote:

Hi All.........

k = InputBox("Enter Lastname, Firstname")

I have the above line in my macro, and once the box appears on the screen,
there is no way to QUIT the program............how do I add a "QUIT" button
to the box, please?

TIA
Vaya con Dios,
Chuck, CABGx3





CLR

How to "Quit"....Input Box
 
Ok...........thank you kindly.........I appreciate that.

Vaya con Dios,
Chuck, CABGx3


"JLGWhiz" wrote in message
...
If you really want to quit the program, you can use the Cancel button with
this code:

If k = "" Or k = False Then
ThisWorkbook.Saved = True
Application.Quit
End If

A word of caution! If you have other workbooks open, this will affect

them.
It also closes without saving anything in the ThisWorkbook sheets that

may
have been added or changed during this session.

"CLR" wrote:

Hi All.........

k = InputBox("Enter Lastname, Firstname")

I have the above line in my macro, and once the box appears on the

screen,
there is no way to QUIT the program............how do I add a "QUIT"

button
to the box, please?

TIA
Vaya con Dios,
Chuck, CABGx3








All times are GMT +1. The time now is 08:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com