Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
graceful exits
This code is used to find and open text files to import into a worksheet.
' Get the file name Dim FName As Variant FName = Application.GetOpenFilename("Excel file (*.txt),*.txt)") If FName = False Then MsgBox "No file selected" Else MsgBox "You chose: " & FName End If In the False section I want to add in a line to simply exit the macro. The functionality I need is: MsgBox "No file selected" Exit_Macro What is the code to exit the macro here? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
graceful exits
Hi Bryan,
Try: MsgBox "No file selected" Exit sub --- Regards, Norman "Bryan" wrote in message ... This code is used to find and open text files to import into a worksheet. ' Get the file name Dim FName As Variant FName = Application.GetOpenFilename("Excel file (*.txt),*.txt)") If FName = False Then MsgBox "No file selected" Else MsgBox "You chose: " & FName End If In the False section I want to add in a line to simply exit the macro. The functionality I need is: MsgBox "No file selected" Exit_Macro What is the code to exit the macro here? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
graceful exits
That does it. Thank you,
Bryan "Norman Jones" wrote in message ... Hi Bryan, Try: MsgBox "No file selected" Exit sub --- Regards, Norman "Bryan" wrote in message ... This code is used to find and open text files to import into a worksheet. ' Get the file name Dim FName As Variant FName = Application.GetOpenFilename("Excel file (*.txt),*.txt)") If FName = False Then MsgBox "No file selected" Else MsgBox "You chose: " & FName End If In the False section I want to add in a line to simply exit the macro. The functionality I need is: MsgBox "No file selected" Exit_Macro What is the code to exit the macro here? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
graceful exits
That's just what I needed.
Thank you, Bryan "Norman Jones" wrote in message ... Hi Bryan, Try: MsgBox "No file selected" Exit sub --- Regards, Norman "Bryan" wrote in message ... This code is used to find and open text files to import into a worksheet. ' Get the file name Dim FName As Variant FName = Application.GetOpenFilename("Excel file (*.txt),*.txt)") If FName = False Then MsgBox "No file selected" Else MsgBox "You chose: " & FName End If In the False section I want to add in a line to simply exit the macro. The functionality I need is: MsgBox "No file selected" Exit_Macro What is the code to exit the macro here? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Marco Exits without error | Excel Discussion (Misc queries) | |||
Prompt msg if the worksheet already exits | New Users to Excel | |||
Find if value exits in array | Excel Worksheet Functions | |||
Test if sheet exits, create with name if not | Excel Programming | |||
validate a directory or file exits | Excel Programming |