vbCancel = True

theta

Well-known Member
Joined
Jun 9, 2009
Messages
960
Hi,

I have the following section of VBA code which works :

CONTRACT = Application.InputBox("Please enter Contract no", "LIFT DETAILS")
If CONTRACT = False Then
Exit Sub
End If


I would rather use the vbCancel object but it gives me 13 error :

CONTRACT = Application.InputBox("Please enter Contract no", "LIFT DETAILS")
If vbCancel = True Then
Exit Sub
End If


Help please?
 

Some videos you may like

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Sorry, that's not possible. vbCancel (value 2) is a member of vbMsgBoxResult and there is no such Enum for an InputBox.
 

theta

Well-known Member
Joined
Jun 9, 2009
Messages
960
I was told if I asked excel nicely it might work? No?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,500
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
No. As a great man once said "this is programming, not magic, unfortunately". ;)
 

Watch MrExcel Video

Forum statistics

Threads
1,108,839
Messages
5,525,160
Members
409,628
Latest member
inatecktechnology

This Week's Hot Topics

Top