Input Boxes in Word

  • Thread starter Thread starter Sophia J
  • Start date Start date
S

Sophia J

Hello:
I am working on a macro in Word, where I have input boxes
for the user to enter text. The input boxes contain
and "OK" button and a "Cancel" When you have more than
one input box in a macro, when you click on "Cancel" it
doesn't let you exit out, instead it just goes to the next
input box. I have tried to put in
If string = vbcancel then End End If

But that doesn't work.


I have also tried to use the cancel property by:
string.cancel = true
and then if string = true exit. But that doesn't work.

I read online that vbvancel really is a numeric character
that equals 2, which is why vbcancel doesn't work.

So my question is:
How do you get the "Cancel" or "X" button on the input box
to work?

I am fairly new at this so I could be overlooking
something.
Any help would be appreciated.
Thanks,
Sophia
(e-mail address removed)
 
If the user cancels the input box, then the InputBox function returns a null string (vbNullString or "")? Your code needs to handle that result and do whatever is appropriate for your application.

Instead of using multiple InputBox functions, you might consider designing a VBA form that allows the user to enter all the necessary data in one interface.

Next time, you might want to ask your Word question in a Word group, rather than in an Outlook group.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
Back
Top