Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Marco Exits without error jlclyde Excel Discussion (Misc queries) 1 June 8th 11 12:02 AM
Prompt msg if the worksheet already exits Dee New Users to Excel 2 November 7th 08 05:11 PM
Find if value exits in array Glynn Excel Worksheet Functions 6 September 5th 08 08:46 PM
Test if sheet exits, create with name if not bramweisman[_8_] Excel Programming 4 October 21st 04 07:26 PM
validate a directory or file exits Simon Shaw[_5_] Excel Programming 1 September 24th 04 02:24 AM


All times are GMT +1. The time now is 03:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"