PC Review


Reply
Thread Tools Rate Thread

Click on the Cancel button

 
 
Woody
Guest
Posts: n/a
 
      22nd Oct 2007
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 With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      22nd Oct 2007
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" <(E-Mail Removed)> wrote in message
news:e$w%(E-Mail Removed)...
> 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 With Quote
 
Woody
Guest
Posts: n/a
 
      22nd Oct 2007
Bob,
I don't understand how this If oDialog.Show can tell me that the user
clicked on the Cancel button ?


"Bob Phillips" <(E-Mail Removed)> a écrit dans le message de news:
%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:e$w%(E-Mail Removed)...
>> 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 With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      22nd Oct 2007
Woody,

Try it and see.

--
---
HTH

Bob

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



"Woody" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Bob,
> I don't understand how this If oDialog.Show can tell me that the user
> clicked on the Cancel button ?
>
>
> "Bob Phillips" <(E-Mail Removed)> a écrit dans le message de news:
> %(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:e$w%(E-Mail Removed)...
>>> 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 With Quote
 
Woody
Guest
Posts: n/a
 
      23rd Oct 2007
I did it. That works fine!

Thanks Bob

"Bob Phillips" <(E-Mail Removed)> a écrit dans le message de news:
eLjBT$(E-Mail Removed)...
> Woody,
>
> Try it and see.
>
> --
> ---
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my
> addy)
>
>
>
> "Woody" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> Bob,
>> I don't understand how this If oDialog.Show can tell me that the user
>> clicked on the Cancel button ?
>>
>>
>> "Bob Phillips" <(E-Mail Removed)> a écrit dans le message de news:
>> %(E-Mail Removed)...
>>> 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" <(E-Mail Removed)> wrote in message
>>> news:e$w%(E-Mail Removed)...
>>>> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: no response for cancel button click Jeff Gaines Microsoft Dot NET 1 7th Jan 2008 03:43 PM
no response for cancel button click linda.chen@faa.gov Microsoft Dot NET Framework Forms 3 7th Jan 2008 03:43 PM
Re: no response for cancel button click Marc Gravell Microsoft Dot NET 0 7th Jan 2008 03:10 PM
Cancel a click event on a button Gallarpri Microsoft C# .NET 3 18th Jan 2007 12:52 PM
Re: Q: how do I interrupt a loop when click a CANCEL button on a form? Peter R. Fletcher Microsoft Access VBA Modules 0 29th Jun 2003 09:22 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:14 PM.