Page 1 sur 1

Déposer un csv

MessagePublié: 05 Mai 2010 à 15:15
par afournery
Bonjour,

sur une action LS je souhaite laisser le choix à l'utilisateur l'emplacement d'un fichier que je vais créer ?

comment faire ?

merci d'avance

MessagePublié: 05 Mai 2010 à 15:16
par Michael DELIQUE
salut

tu veux un sélecteur de répertoire ?

MessagePublié: 05 Mai 2010 à 15:19
par afournery
oui

NotesUIWorkSpace.openFileDialog ne fonction que si le fichier existe

MessagePublié: 05 Mai 2010 à 15:43
par Michael DELIQUE
le même version API

Code : Tout sélectionner
Public Function GetDirectory_API(wnbRepertoire As Long) As String
   'Cette Fonction permet de faire la sélection d'un répertoire
   
%REM
'variable API pour la fonction GetDirectory_API
'Type BROWSERINFO
'   nbOwner As Long
'   nbRoot As Long
'   nbDisplayName As String
'   BITitle As String
'   nbFlag As Long
'   nblpfn As Long
'   nbParam As Long
'   nbImage As Long
'End Type

'Declare Function GetActiveWindow Lib "user32.dll" () As Long
'Declare Function BrowseFolderDlg Lib "shell32.dll" Alias "SHBrowseForFolder" (lpBrowseInfo As BROWSERINFO) As Long
'Declare Function GetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDList" (Byval nbPointer As Long, Byval PathBuffer As String) As Long
%END REM
   
   'Déclaration des Variables   
   Dim InfoNavigation As BROWSERINFO
   Dim nbPointer As Long
   Dim nbResult As Long
   Dim PathBuffer As String
   Dim PathRepertoire As String
   
   On Error Goto ErreurGetDirectory_API
   
   InfoNavigation.nbOwner = GetActiveWindow()
   
   ' Répertoire par défaut
   Select Case wnbRepertoire
   Case 0 'Poste de Travail
      InfoNavigation.nbRoot = 0
   Case 5 'Mes Documents
      InfoNavigation.nbRoot = 5
   Case Else
      InfoNavigation.nbRoot = 0
   End Select
   
   InfoNavigation.BITitle = "Sélectionnez le répertoire : "
   InfoNavigation.nbDisplayName = String(255, Chr(0))
   InfoNavigation.nbFlag = 1
   
   nbPointer = BrowseFolderDlg(InfoNavigation)
   
   If nbPointer <> 0 Then
      PathBuffer = String(255, Chr(0))
      nbResult = GetPathFromIDList(Byval nbPointer, Byval PathBuffer)
      PathRepertoire = Left(PathBuffer, Instr(PathBuffer, Chr(0)) - 1)
   End If
   
   GetDirectory_API = PathRepertoire
   
   Exit Function
ErreurGetDirectory_API:
   Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
   GetDirectory_API = ""
   Exit Function
End Function