Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello there,
I have read many instances of how to use the Open dialog on many different sites and haven't found a way to capture the 'cancel' button when there is a file already selected. Here is the code that I am using: FilePathAndName= Range("BY35").Value Application.Dialogs(xlDialogOpen).Show FilePathAndName I know that there is another way to get the open dialog box using the following code: FileName = Application.GetOpenFilename Even this has problems handling the 'cancel' button when a file was selected. Can anyone help? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
executing this line:
Result=Application.Dialogs(xlDialogOpen).Show returns True if a file has been opened, and FALSE if the user presses Cancel. -- p45cal "theSquirrel" wrote: Hello there, I have read many instances of how to use the Open dialog on many different sites and haven't found a way to capture the 'cancel' button when there is a file already selected. Here is the code that I am using: FilePathAndName= Range("BY35").Value Application.Dialogs(xlDialogOpen).Show FilePathAndName I know that there is another way to get the open dialog box using the following code: FileName = Application.GetOpenFilename Even this has problems handling the 'cancel' button when a file was selected. Can anyone help? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Sub test() Filename = Application.GetOpenFilename If Filename = False Then MsgBox "User Cancelled!" End If 'or If Application.Dialogs(xlDialogOpen).Show("Z:\TEMP\*. xls") = False Then MsgBox "User Cancelled!" End If End Sub -- Hope that helps. Vergel Adriano "theSquirrel" wrote: Hello there, I have read many instances of how to use the Open dialog on many different sites and haven't found a way to capture the 'cancel' button when there is a file already selected. Here is the code that I am using: FilePathAndName= Range("BY35").Value Application.Dialogs(xlDialogOpen).Show FilePathAndName I know that there is another way to get the open dialog box using the following code: FileName = Application.GetOpenFilename Even this has problems handling the 'cancel' button when a file was selected. Can anyone help? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is something like what I have used in the past and have never had
any problems, whether a file is selected or not. s = Application.GetOpenFilename If s = False Or s = "" Then Exit Sub MsgBox s theSquirrel wrote: Hello there, I have read many instances of how to use the Open dialog on many different sites and haven't found a way to capture the 'cancel' button when there is a file already selected. Here is the code that I am using: FilePathAndName= Range("BY35").Value Application.Dialogs(xlDialogOpen).Show FilePathAndName I know that there is another way to get the open dialog box using the following code: FileName = Application.GetOpenFilename Even this has problems handling the 'cancel' button when a file was selected. Can anyone help? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sep 6, 10:36 am, Vergel Adriano
wrote: Sub test() Filename = Application.GetOpenFilename If Filename = False Then MsgBox "User Cancelled!" End If 'or If Application.Dialogs(xlDialogOpen).Show("Z:\TEMP\*. xls") = False Then MsgBox "User Cancelled!" End If End Sub -- Hope that helps. Vergel Adriano "theSquirrel" wrote: Hello there, I have read many instances of how to use the Open dialog on many different sites and haven't found a way to capture the 'cancel' button when there is a file already selected. Here is the code that I am using: FilePathAndName= Range("BY35").Value Application.Dialogs(xlDialogOpen).Show FilePathAndName I know that there is another way to get the open dialog box using the following code: FileName = Application.GetOpenFilename Even this has problems handling the 'cancel' button when a file was selected. Can anyone help? Vergel... This is brilliant! it is exactly what I was looking for!! If Application.Dialogs(xlDialogOpen).Show("Z:\TEMP\*. xls") = False Then MsgBox "User Cancelled!" End If |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Application.Dialogs(xlDialogPrint).Show - prints too soon | Excel Discussion (Misc queries) | |||
returning values application.dialogs(...).show | Excel Programming | |||
Application.Dialogs(xlDialogSendMail).Show | Excel Programming | |||
Capturing Cancel button on save file dialogue | Excel Programming | |||
xlDialogOpen.Show or Activeworkbook.Path? | Excel Worksheet Functions |