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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

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,509
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,109,131
Messages
5,527,023
Members
409,736
Latest member
maanbunty

This Week's Hot Topics

Top