Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Click on the Cancel button

Hello,

The following procédure opens a dialog box which allows to select a file.
I would like to capture the Click on the Cancel button to stop the
procedure.
How can I do that?
Thanks for your help

Woody

Dim oDialog As Office.FileDialog

Set oDialog = XLApp.FileDialog(msoFileDialogFilePicker) 'Opens a
dialog MS Office FilePicker
oDialog.Filters.Add "Fichiers Excel", "*.xls" 'Select
workbook .XLS
oDialog.Title = "Sélectionnez le fichier Excel" 'Title of
dialog
oDialog.AllowMultiSelect = False 'No multiple
selection
oDialog.Show 'Display the
dialog
If oDialog.SelectedItems.Count 0 Then
NomClasseurXL = oDialog.SelectedItems(1)
MsgBox "Le classeur Excel sélectionné est : " & NomClasseurXL
End If
Set oDialog = Nothing


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Click on the Cancel button

Dim oDialog As Office.FileDialog
Dim XLApp
Set XLApp = Application

Set oDialog = XLApp.FileDialog(msoFileDialogFilePicker) 'Opens a
dialog MS Office FilePicker
oDialog.Filters.Add "Fichiers Excel", "*.xls" 'Select
Workbook .XLS
oDialog.Title = "Sélectionnez le fichier Excel" 'Title of
Dialog
oDialog.AllowMultiSelect = False 'No multiple
Selection
If oDialog.Show Then 'Display the
Dialog
MsgBox "yes"
If oDialog.SelectedItems.Count 0 Then
NomClasseurXL = oDialog.SelectedItems(1)
MsgBox "Le classeur Excel sélectionné est : " & NomClasseurXL
End If
End If
Set oDialog = Nothing


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Woody" wrote in message
...
Hello,

The following procédure opens a dialog box which allows to select a file.
I would like to capture the Click on the Cancel button to stop the
procedure.
How can I do that?
Thanks for your help

Woody

Dim oDialog As Office.FileDialog

Set oDialog = XLApp.FileDialog(msoFileDialogFilePicker) 'Opens a
dialog MS Office FilePicker
oDialog.Filters.Add "Fichiers Excel", "*.xls" 'Select
workbook .XLS
oDialog.Title = "Sélectionnez le fichier Excel" 'Title of
dialog
oDialog.AllowMultiSelect = False 'No
multiple selection
oDialog.Show 'Display
the dialog
If oDialog.SelectedItems.Count 0 Then
NomClasseurXL = oDialog.SelectedItems(1)
MsgBox "Le classeur Excel sélectionné est : " & NomClasseurXL
End If
Set oDialog = Nothing



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Click on the Cancel button

Bob,
I don't understand how this If oDialog.Show can tell me that the user
clicked on the Cancel button ?


"Bob Phillips" a écrit dans le message de news:
...
Dim oDialog As Office.FileDialog
Dim XLApp
Set XLApp = Application

Set oDialog = XLApp.FileDialog(msoFileDialogFilePicker) 'Opens a
dialog MS Office FilePicker
oDialog.Filters.Add "Fichiers Excel", "*.xls" 'Select
Workbook .XLS
oDialog.Title = "Sélectionnez le fichier Excel" 'Title of
Dialog
oDialog.AllowMultiSelect = False 'No
multiple Selection
If oDialog.Show Then 'Display
the Dialog
MsgBox "yes"
If oDialog.SelectedItems.Count 0 Then
NomClasseurXL = oDialog.SelectedItems(1)
MsgBox "Le classeur Excel sélectionné est : " & NomClasseurXL
End If
End If
Set oDialog = Nothing


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Woody" wrote in message
...
Hello,

The following procédure opens a dialog box which allows to select a file.
I would like to capture the Click on the Cancel button to stop the
procedure.
How can I do that?
Thanks for your help

Woody

Dim oDialog As Office.FileDialog

Set oDialog = XLApp.FileDialog(msoFileDialogFilePicker) 'Opens a
dialog MS Office FilePicker
oDialog.Filters.Add "Fichiers Excel", "*.xls" 'Select
workbook .XLS
oDialog.Title = "Sélectionnez le fichier Excel" 'Title of
dialog
oDialog.AllowMultiSelect = False 'No
multiple selection
oDialog.Show 'Display
the dialog
If oDialog.SelectedItems.Count 0 Then
NomClasseurXL = oDialog.SelectedItems(1)
MsgBox "Le classeur Excel sélectionné est : " & NomClasseurXL
End If
Set oDialog = Nothing





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Click on the Cancel button

Woody,

Try it and see.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Woody" wrote in message
...
Bob,
I don't understand how this If oDialog.Show can tell me that the user
clicked on the Cancel button ?


"Bob Phillips" a écrit dans le message de news:
...
Dim oDialog As Office.FileDialog
Dim XLApp
Set XLApp = Application

Set oDialog = XLApp.FileDialog(msoFileDialogFilePicker) 'Opens a
dialog MS Office FilePicker
oDialog.Filters.Add "Fichiers Excel", "*.xls" 'Select
Workbook .XLS
oDialog.Title = "Sélectionnez le fichier Excel" 'Title of
Dialog
oDialog.AllowMultiSelect = False 'No
multiple Selection
If oDialog.Show Then 'Display
the Dialog
MsgBox "yes"
If oDialog.SelectedItems.Count 0 Then
NomClasseurXL = oDialog.SelectedItems(1)
MsgBox "Le classeur Excel sélectionné est : " & NomClasseurXL
End If
End If
Set oDialog = Nothing


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Woody" wrote in message
...
Hello,

The following procédure opens a dialog box which allows to select a
file.
I would like to capture the Click on the Cancel button to stop the
procedure.
How can I do that?
Thanks for your help

Woody

Dim oDialog As Office.FileDialog

Set oDialog = XLApp.FileDialog(msoFileDialogFilePicker) 'Opens a
dialog MS Office FilePicker
oDialog.Filters.Add "Fichiers Excel", "*.xls" 'Select
workbook .XLS
oDialog.Title = "Sélectionnez le fichier Excel" 'Title of
dialog
oDialog.AllowMultiSelect = False 'No
multiple selection
oDialog.Show 'Display
the dialog
If oDialog.SelectedItems.Count 0 Then
NomClasseurXL = oDialog.SelectedItems(1)
MsgBox "Le classeur Excel sélectionné est : " & NomClasseurXL
End If
Set oDialog = Nothing







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Click on the Cancel button

I did it. That works fine!

Thanks Bob

"Bob Phillips" a écrit dans le message de news:
...
Woody,

Try it and see.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Woody" wrote in message
...
Bob,
I don't understand how this If oDialog.Show can tell me that the user
clicked on the Cancel button ?


"Bob Phillips" a écrit dans le message de news:
...
Dim oDialog As Office.FileDialog
Dim XLApp
Set XLApp = Application

Set oDialog = XLApp.FileDialog(msoFileDialogFilePicker) 'Opens a
dialog MS Office FilePicker
oDialog.Filters.Add "Fichiers Excel", "*.xls" 'Select
Workbook .XLS
oDialog.Title = "Sélectionnez le fichier Excel" 'Title of
Dialog
oDialog.AllowMultiSelect = False 'No
multiple Selection
If oDialog.Show Then 'Display
the Dialog
MsgBox "yes"
If oDialog.SelectedItems.Count 0 Then
NomClasseurXL = oDialog.SelectedItems(1)
MsgBox "Le classeur Excel sélectionné est : " & NomClasseurXL
End If
End If
Set oDialog = Nothing


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Woody" wrote in message
...
Hello,

The following procédure opens a dialog box which allows to select a
file.
I would like to capture the Click on the Cancel button to stop the
procedure.
How can I do that?
Thanks for your help

Woody

Dim oDialog As Office.FileDialog

Set oDialog = XLApp.FileDialog(msoFileDialogFilePicker) 'Opens a
dialog MS Office FilePicker
oDialog.Filters.Add "Fichiers Excel", "*.xls" 'Select
workbook .XLS
oDialog.Title = "Sélectionnez le fichier Excel" 'Title
of dialog
oDialog.AllowMultiSelect = False 'No
multiple selection
oDialog.Show 'Display
the dialog
If oDialog.SelectedItems.Count 0 Then
NomClasseurXL = oDialog.SelectedItems(1)
MsgBox "Le classeur Excel sélectionné est : " & NomClasseurXL
End If
Set oDialog = Nothing









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
Cannot seem to Cancel EXCEL App Right Click Event using C# Nick Biggs Excel Programming 18 October 28th 09 08:16 AM
Cancel Hyperlink Click [email protected] Excel Programming 4 October 17th 06 01:23 AM
VBScript to prompt Save on Cancel click paperclip[_2_] Excel Programming 8 August 3rd 06 04:11 PM
Cancel button to cancel the whole macro excelnut1954 Excel Programming 3 January 17th 06 08:27 PM
how to stop program with loop by click "Cancel" button miao jie Excel Programming 2 December 16th 04 02:42 PM


All times are GMT +1. The time now is 12:28 AM.

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"