Boite ouverture fichier au format grand icone

christ-94

XLDnaute Occasionnel
Bonjour

j'aimerai que lorsque j'exécute ce code "il sert a récupérer le nom d'un fichier image sélectionné par l'utilisateur dans un répertoire donné"

Code:
Sub choisir_fichier()
    Application.ScreenUpdating = False
Call remise_en_etat
Sheets.Add.Name = "Import"
Application.EnableEvents = True ' arret alarme
classeur_import = Sheets("protege").Range("a5")
'choix du repertoire
ChDir ("C:\Tmp\Nouveau dossier (2)\")
nf = Application.GetOpenFilename("Fichiers Xls,*.jpg")
Sheets("protege").Range("a8") = nf
End Sub

que l'affichage dans l'exploreur Windows soit pré-paramètre sur grand icône pour avoir une vue des images lors de la sélection

Merci d'avance
 
Dernière édition:

tototiti2008

XLDnaute Barbatruc
Re : Boite ouverture fichier au format grand icone

Bonjour christ,

peut-être


Code:
Sub choisir_fichier()
Dim FD As FileDialog, nf as string
    Application.ScreenUpdating = False
Call remise_en_etat
Sheets.Add.Name = "Import"
Application.EnableEvents = True ' arret alarme
classeur_import = Sheets("protege").Range("a5")
'choix du repertoire
Set FD = Application.FileDialog(msoFileDialogOpen)
nf=""
With FD
    .AllowMultiSelect = False
    .Filters.Clear
    .Filters.Add "Fichiers JPEG", "*.jpg"
    .InitialFileName = "C:\Tmp\Nouveau dossier (2)\"
    .InitialView = msoFileDialogViewThumbnail
    If .Show <> 0 Then
        nf = .SelectedItems(1)
        MsgBox nf
    End If
End With
Sheets("protege").Range("a8") = nf
end sub
 

christ-94

XLDnaute Occasionnel
Re : Boite ouverture fichier au format grand icone

re-bonjour et merci

je viens de faire le test cela n'a pas fonctionne
si je passe l'affichage des fichiers en détail et que je relance la macro
l'affichage est toujours en détail et pas en grand icône
 

christ-94

XLDnaute Occasionnel
Re : Boite ouverture fichier au format grand icone

je mets une image pour plus de compréhension

Merci de votre aide

Christophe
 

Pièces jointes

  • Sans titre.jpg
    Sans titre.jpg
    27.3 KB · Affichages: 88
  • Sans titre.jpg
    Sans titre.jpg
    27.3 KB · Affichages: 86
  • Sans titre.jpg
    Sans titre.jpg
    27.3 KB · Affichages: 91

christ-94

XLDnaute Occasionnel
Re : Boite ouverture fichier au format grand icone

en tout cas un grand merci
car j'ai la fonction , effectivement cela ne fonctionne pas car il y a un blocage, mais j'ai avance
pour répondre j'ai un VISTA et office 2007

ci-joint le code de l'aide qui ne fonctionne pas chez moi non plus

Code:
Sub Main()

    'Declare a variable as a FileDialog object.
    Dim fd As FileDialog

    'Create a FileDialog object as a File Picker dialog box.
    Set fd = Application.FileDialog(msoFileDialogFilePicker)

    'Declare a variable to contain the path
    'of each selected item. Even though the path is aString,
    'the variable must be a Variant because For Each...Next
    'routines only work with Variants and Objects.
    Dim vrtSelectedItem As Variant

    'Use a With...End With block to reference the FileDialog object.
    With fd
        
        'Set the initial view to the details view.
        .InitialView = msoFileDialogViewDetails

        'Use the Show method to display the File Picker dialog box and return the user's action.
        'If the user presses the button...
        If .Show = -1 Then

            'Step through each string in the FileDialogSelectedItems collection.
            For Each vrtSelectedItem In .SelectedItems

                'vrtSelectedItem is aString that contains the path of each selected item.
                'You can use any file I/O functions that you want to work with this path.
                'This example displays the path in a message box.
                MsgBox "Selected item's path: " & vrtSelectedItem

            Next vrtSelectedItem
        'If the user presses Cancel...
        Else
        End If
    End With

    'Set the object variable to Nothing.
    Set fd = Nothing

End Sub
 

Discussions similaires

Statistiques des forums

Discussions
312 857
Messages
2 092 865
Membres
105 545
dernier inscrit
pourmanger