Pause Excel Macro

O

Ollie

I have followed a discussion group suggestion and created a macro as follows:
dim myStr as string
"your code that does something'
mystr = inputbox (Prompy:= "Please type something")
msgbox "Hey, you typed: " & mystr
"your code that does more'

This works well thanks to Dave Peterson but when I run the macro it gives 2
option Cancel and OK. I was wondering if it can be created to only give the
OK option so that something must be entered to continue.

Thanks
 
K

Ken Johnson

Ollie said:
I have followed a discussion group suggestion and created a macro as follows:
dim myStr as string
"your code that does something'
mystr = inputbox (Prompy:= "Please type something")
msgbox "Hey, you typed: " & mystr
"your code that does more'

This works well thanks to Dave Peterson but when I run the macro it gives 2
option Cancel and OK. I was wondering if it can be created to only give the
OK option so that something must be entered to continue.

Thanks

Hi Ollie,

Here's one way...

Public Sub MustEnter()
Dim mystring As String
Do While mystring = ""
mystring = InputBox("Please type something")
If mystring = "" Then MsgBox _
"You're not getting off that lightly buster!"
Loop
MsgBox "You typed " & mystring
End Sub
According to the help files there is no option for changing the
inputbox buttons.

Ken Johnson
 
O

Ollie

Thank you Ken

This works very well for me.
Very much appreciate you help
Regards
Ollie
 

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