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? |
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? |
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? |
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? |
All times are GMT +1. The time now is 09:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com