Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
This should be fairly simple for a lot of you but I am struggling with it. I have a macro that opens up a dialog box to allow users open the input data file to be processed using macro. Many a times users click cancel instead of opening the file and in that case I get a run time error. What is want is when the users cancel it should just give them a message and macro should end while if they opened the input file then the rest of the macro should run. Can someone help me with this? Thanks. - AG |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How about:
Sub dural() Filename = Application.GetOpenFilename() If Filename = False Then Exit Sub End If MsgBox (Filename) End Sub -- Gary''s Student - gsnu200901 "AG" wrote: Hi, This should be fairly simple for a lot of you but I am struggling with it. I have a macro that opens up a dialog box to allow users open the input data file to be processed using macro. Many a times users click cancel instead of opening the file and in that case I get a run time error. What is want is when the users cancel it should just give them a message and macro should end while if they opened the input file then the rest of the macro should run. Can someone help me with this? Thanks. - AG |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
thanks for your help on this. The first part is working fine now,that is, if the user cancels then it stops but I had added the else part in there which does not execute at all. Not sure what is the reason. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Got the issue resolved. Actually I just needed to add a statement to
open the workbook if the user selected one. It works perfectly now. Thanks for the help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 macro: Dialogbox for saving a file as type Microsoft Ex | Excel Programming | |||
Open the SaveAs Dialogbox | Excel Programming | |||
Excel remaining open on workbook exit | Excel Programming | |||
Open DialogBox in VBA | Excel Programming | |||
how to detect if user has a dialogbox open | Excel Programming |