Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 90244

How to handle the InputBox cancel button?

$
0
0

I type in the start date and the end date and execute a code of export from Outlook.

Sub ExportFromOutlook()
Dim dteStart As Date
Dim dteEnd As Date

dteStart = InputBox("What is the start date?", "Export Outlook Calendar")
dteEnd = InputBox("What is the end date?", "Export Outlook Calendar")
Call GetCalData(dteStart, dteEnd)
End Sub

I want when I press the "Cancel button" on any of the Inputboxes to exit the sub, not to get an error in the VBA code to debug it.


Viewing all articles
Browse latest Browse all 90244


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>