j'ai le code suivant me permettant d'ouvrir un fichier dans access :
Option Compare Database
Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long
Public Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
Public Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Function GetDirectory(Optional Msg) As String
Dim bInfo As BROWSEINFO
Dim path As String
Dim R As Long, X As Long, Pos As Integer
bInfo.pidlRoot =3D 0
If IsMissing(Msg) Then
bInfo.lpszTitle =3D "Choisir le fichier."
Else
bInfo.lpszTitle =3D Msg
End If
bInfo.ulFlags =3D &H1
X =3D SHBrowseForFolder(bInfo)
path =3D Space$(512)
R =3D SHGetPathFromIDList(ByVal X, ByVal path)
If R Then
Pos =3D InStr(path, Chr$(0))
GetDirectory =3D Left(path, Pos - 1)
Else
GetDirectory =3D ""
End If
End Function
J'arrive =E0 faire fonctionner ce module mais pas =E0 l'incorporer dans un
formulaire
j'ai le code suivant me permettant d'ouvrir un fichier dans access :
Option Compare Database
Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _ Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _ ByVal pszPath As String) As Long
Public Declare Function SHBrowseForFolder Lib "shell32.dll" _ Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
Public Type BROWSEINFO hOwner As Long pidlRoot As Long pszDisplayName As String lpszTitle As String ulFlags As Long lpfn As Long lParam As Long iImage As Long End Type
Function GetDirectory(Optional Msg) As String
Dim bInfo As BROWSEINFO Dim path As String Dim R As Long, X As Long, Pos As Integer
bInfo.pidlRoot = 0
If IsMissing(Msg) Then bInfo.lpszTitle = "Choisir le fichier." Else bInfo.lpszTitle = Msg End If
bInfo.ulFlags = &H1
X = SHBrowseForFolder(bInfo)
path = Space$(512) R = SHGetPathFromIDList(ByVal X, ByVal path)
If R Then Pos = InStr(path, Chr$(0)) GetDirectory = Left(path, Pos - 1) Else GetDirectory = "" End If
End Function
J'arrive à faire fonctionner ce module mais pas à l'incorporer dans un formulaire
Comment faire ???
merci
Salut,
Tu dis :
J'arrive à faire fonctionner ce module mais pas à l'incorporer dans un
formulaire
Bizarre... comment tu le fais fonctionner, dans ce cas ;-)
Colle le dans un module et tu pourras l'appeler de n'importe où...
j'ai le code suivant me permettant d'ouvrir un fichier dans access :
Option Compare Database
Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long
Public Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
Public Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Function GetDirectory(Optional Msg) As String
Dim bInfo As BROWSEINFO
Dim path As String
Dim R As Long, X As Long, Pos As Integer
bInfo.pidlRoot = 0
If IsMissing(Msg) Then
bInfo.lpszTitle = "Choisir le fichier."
Else
bInfo.lpszTitle = Msg
End If
bInfo.ulFlags = &H1
X = SHBrowseForFolder(bInfo)
path = Space$(512)
R = SHGetPathFromIDList(ByVal X, ByVal path)
If R Then
Pos = InStr(path, Chr$(0))
GetDirectory = Left(path, Pos - 1)
Else
GetDirectory = ""
End If
End Function
J'arrive à faire fonctionner ce module mais pas à l'incorporer dans un
formulaire
j'ai le code suivant me permettant d'ouvrir un fichier dans access :
Option Compare Database
Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _ Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _ ByVal pszPath As String) As Long
Public Declare Function SHBrowseForFolder Lib "shell32.dll" _ Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
Public Type BROWSEINFO hOwner As Long pidlRoot As Long pszDisplayName As String lpszTitle As String ulFlags As Long lpfn As Long lParam As Long iImage As Long End Type
Function GetDirectory(Optional Msg) As String
Dim bInfo As BROWSEINFO Dim path As String Dim R As Long, X As Long, Pos As Integer
bInfo.pidlRoot = 0
If IsMissing(Msg) Then bInfo.lpszTitle = "Choisir le fichier." Else bInfo.lpszTitle = Msg End If
bInfo.ulFlags = &H1
X = SHBrowseForFolder(bInfo)
path = Space$(512) R = SHGetPathFromIDList(ByVal X, ByVal path)
If R Then Pos = InStr(path, Chr$(0)) GetDirectory = Left(path, Pos - 1) Else GetDirectory = "" End If
End Function
J'arrive à faire fonctionner ce module mais pas à l'incorporer dans un formulaire
Comment faire ???
merci
MINOT gilles
On 30 août, 17:31, "3stone" wrote:
Salut,
Tu dis :
> J'arrive à faire fonctionner ce module mais pas à l'incorporer dans un > formulaire
Bizarre... comment tu le fais fonctionner, dans ce cas ;-)
Colle le dans un module et tu pourras l'appeler de n'importe où...
-- A+ Pierre (3stone) Access MVP Perso:http://www.3stone.be/ MPFA:http://www.mpfa.info/ (infos générales)
jc wrote: > Bonjour,
> j'ai le code suivant me permettant d'ouvrir un fichier dans access :
> Option Compare Database
> Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _ > Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _ > ByVal pszPath As String) As Long
> Public Declare Function SHBrowseForFolder Lib "shell32.dll" _ > Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
> Public Type BROWSEINFO > hOwner As Long > pidlRoot As Long > pszDisplayName As String > lpszTitle As String > ulFlags As Long > lpfn As Long > lParam As Long > iImage As Long > End Type
> Function GetDirectory(Optional Msg) As String
> Dim bInfo As BROWSEINFO > Dim path As String > Dim R As Long, X As Long, Pos As Integer
> bInfo.pidlRoot = 0
> If IsMissing(Msg) Then > bInfo.lpszTitle = "Choisir le fichier." > Else > bInfo.lpszTitle = Msg > End If
> If R Then > Pos = InStr(path, Chr$(0)) > GetDirectory = Left(path, Pos - 1) > Else > GetDirectory = "" > End If
> End Function
> J'arrive à faire fonctionner ce module mais pas à l'incorporer dans un > formulaire
> Comment faire ???
> merci- Masquer le texte des messages précédents -
- Afficher le texte des messages précédents -
une fois que tu as colle dans un module .dans ton formulaire tu cree un bouton et sur l'evenement clik unee procedure evenementiel tu colles :
GetDirectory
A plus
On 30 août, 17:31, "3stone" <home@sweet_home.be> wrote:
Salut,
Tu dis :
> J'arrive à faire fonctionner ce module mais pas à l'incorporer dans un
> formulaire
Bizarre... comment tu le fais fonctionner, dans ce cas ;-)
Colle le dans un module et tu pourras l'appeler de n'importe où...
--
A+
Pierre (3stone) Access MVP
Perso:http://www.3stone.be/
MPFA:http://www.mpfa.info/ (infos générales)
jc wrote:
> Bonjour,
> j'ai le code suivant me permettant d'ouvrir un fichier dans access :
> Option Compare Database
> Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _
> Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _
> ByVal pszPath As String) As Long
> Public Declare Function SHBrowseForFolder Lib "shell32.dll" _
> Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
> Public Type BROWSEINFO
> hOwner As Long
> pidlRoot As Long
> pszDisplayName As String
> lpszTitle As String
> ulFlags As Long
> lpfn As Long
> lParam As Long
> iImage As Long
> End Type
> Function GetDirectory(Optional Msg) As String
> Dim bInfo As BROWSEINFO
> Dim path As String
> Dim R As Long, X As Long, Pos As Integer
> bInfo.pidlRoot = 0
> If IsMissing(Msg) Then
> bInfo.lpszTitle = "Choisir le fichier."
> Else
> bInfo.lpszTitle = Msg
> End If
> J'arrive à faire fonctionner ce module mais pas à l'incorporer dans un > formulaire
Bizarre... comment tu le fais fonctionner, dans ce cas ;-)
Colle le dans un module et tu pourras l'appeler de n'importe où...
-- A+ Pierre (3stone) Access MVP Perso:http://www.3stone.be/ MPFA:http://www.mpfa.info/ (infos générales)
jc wrote: > Bonjour,
> j'ai le code suivant me permettant d'ouvrir un fichier dans access :
> Option Compare Database
> Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _ > Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _ > ByVal pszPath As String) As Long
> Public Declare Function SHBrowseForFolder Lib "shell32.dll" _ > Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
> Public Type BROWSEINFO > hOwner As Long > pidlRoot As Long > pszDisplayName As String > lpszTitle As String > ulFlags As Long > lpfn As Long > lParam As Long > iImage As Long > End Type
> Function GetDirectory(Optional Msg) As String
> Dim bInfo As BROWSEINFO > Dim path As String > Dim R As Long, X As Long, Pos As Integer
> bInfo.pidlRoot = 0
> If IsMissing(Msg) Then > bInfo.lpszTitle = "Choisir le fichier." > Else > bInfo.lpszTitle = Msg > End If
> If R Then > Pos = InStr(path, Chr$(0)) > GetDirectory = Left(path, Pos - 1) > Else > GetDirectory = "" > End If
> End Function
> J'arrive à faire fonctionner ce module mais pas à l'incorporer dans un > formulaire
> Comment faire ???
> merci- Masquer le texte des messages précédents -
- Afficher le texte des messages précédents -
une fois que tu as colle dans un module .dans ton formulaire tu cree un bouton et sur l'evenement clik unee procedure evenementiel tu colles :
GetDirectory
A plus
Gilbert
Bonjour,
Pour appeler cette fonction d'un formulaire, il te faut la déclarer publique:
Public Function GetDirectory(Optional Msg) As String ... ... ... End Function
-- Cordialement,
Gilbert
"MINOT gilles" a écrit dans le message de news: On 30 août, 17:31, "3stone" wrote:
Salut,
Tu dis :
> J'arrive à faire fonctionner ce module mais pas à l'incorporer dans un > formulaire
Bizarre... comment tu le fais fonctionner, dans ce cas ;-)
Colle le dans un module et tu pourras l'appeler de n'importe où...
-- A+ Pierre (3stone) Access MVP Perso:http://www.3stone.be/ MPFA:http://www.mpfa.info/ (infos générales)
jc wrote: > Bonjour,
> j'ai le code suivant me permettant d'ouvrir un fichier dans access :
> Option Compare Database
> Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _ > Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _ > ByVal pszPath As String) As Long
> Public Declare Function SHBrowseForFolder Lib "shell32.dll" _ > Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
> Public Type BROWSEINFO > hOwner As Long > pidlRoot As Long > pszDisplayName As String > lpszTitle As String > ulFlags As Long > lpfn As Long > lParam As Long > iImage As Long > End Type
> Function GetDirectory(Optional Msg) As String
> Dim bInfo As BROWSEINFO > Dim path As String > Dim R As Long, X As Long, Pos As Integer
> bInfo.pidlRoot = 0
> If IsMissing(Msg) Then > bInfo.lpszTitle = "Choisir le fichier." > Else > bInfo.lpszTitle = Msg > End If
> If R Then > Pos = InStr(path, Chr$(0)) > GetDirectory = Left(path, Pos - 1) > Else > GetDirectory = "" > End If
> End Function
> J'arrive à faire fonctionner ce module mais pas à l'incorporer dans un > formulaire
> Comment faire ???
> merci- Masquer le texte des messages précédents -
- Afficher le texte des messages précédents -
une fois que tu as colle dans un module .dans ton formulaire tu cree un bouton et sur l'evenement clik unee procedure evenementiel tu colles :
GetDirectory
A plus
Bonjour,
Pour appeler cette fonction d'un formulaire, il te faut la déclarer
publique:
Public Function GetDirectory(Optional Msg) As String
...
...
...
End Function
--
Cordialement,
Gilbert
"MINOT gilles" <gminot@amada.fr> a écrit dans le message de
news:81c04c86-7ba6-40f0-aa8b-7c21d6dd1674@p36g2000vbn.googlegroups.com...
On 30 août, 17:31, "3stone" <home@sweet_home.be> wrote:
Salut,
Tu dis :
> J'arrive à faire fonctionner ce module mais pas à l'incorporer dans un
> formulaire
Bizarre... comment tu le fais fonctionner, dans ce cas ;-)
Colle le dans un module et tu pourras l'appeler de n'importe où...
--
A+
Pierre (3stone) Access MVP
Perso:http://www.3stone.be/
MPFA:http://www.mpfa.info/ (infos générales)
jc wrote:
> Bonjour,
> j'ai le code suivant me permettant d'ouvrir un fichier dans access :
> Option Compare Database
> Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _
> Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _
> ByVal pszPath As String) As Long
> Public Declare Function SHBrowseForFolder Lib "shell32.dll" _
> Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
> Public Type BROWSEINFO
> hOwner As Long
> pidlRoot As Long
> pszDisplayName As String
> lpszTitle As String
> ulFlags As Long
> lpfn As Long
> lParam As Long
> iImage As Long
> End Type
> Function GetDirectory(Optional Msg) As String
> Dim bInfo As BROWSEINFO
> Dim path As String
> Dim R As Long, X As Long, Pos As Integer
> bInfo.pidlRoot = 0
> If IsMissing(Msg) Then
> bInfo.lpszTitle = "Choisir le fichier."
> Else
> bInfo.lpszTitle = Msg
> End If
Pour appeler cette fonction d'un formulaire, il te faut la déclarer publique:
Public Function GetDirectory(Optional Msg) As String ... ... ... End Function
-- Cordialement,
Gilbert
"MINOT gilles" a écrit dans le message de news: On 30 août, 17:31, "3stone" wrote:
Salut,
Tu dis :
> J'arrive à faire fonctionner ce module mais pas à l'incorporer dans un > formulaire
Bizarre... comment tu le fais fonctionner, dans ce cas ;-)
Colle le dans un module et tu pourras l'appeler de n'importe où...
-- A+ Pierre (3stone) Access MVP Perso:http://www.3stone.be/ MPFA:http://www.mpfa.info/ (infos générales)
jc wrote: > Bonjour,
> j'ai le code suivant me permettant d'ouvrir un fichier dans access :
> Option Compare Database
> Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _ > Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _ > ByVal pszPath As String) As Long
> Public Declare Function SHBrowseForFolder Lib "shell32.dll" _ > Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
> Public Type BROWSEINFO > hOwner As Long > pidlRoot As Long > pszDisplayName As String > lpszTitle As String > ulFlags As Long > lpfn As Long > lParam As Long > iImage As Long > End Type
> Function GetDirectory(Optional Msg) As String
> Dim bInfo As BROWSEINFO > Dim path As String > Dim R As Long, X As Long, Pos As Integer
> bInfo.pidlRoot = 0
> If IsMissing(Msg) Then > bInfo.lpszTitle = "Choisir le fichier." > Else > bInfo.lpszTitle = Msg > End If
> > j'ai le code suivant me permettant d'ouvrir un fichier dans access :
> > Option Compare Database
> > Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _ > > Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _ > > ByVal pszPath As String) As Long
> > Public Declare Function SHBrowseForFolder Lib "shell32.dll" _ > > Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
> > Public Type BROWSEINFO > > hOwner As Long > > pidlRoot As Long > > pszDisplayName As String > > lpszTitle As String > > ulFlags As Long > > lpfn As Long > > lParam As Long > > iImage As Long > > End Type
> > Function GetDirectory(Optional Msg) As String
> > Dim bInfo As BROWSEINFO > > Dim path As String > > Dim R As Long, X As Long, Pos As Integer
> > bInfo.pidlRoot = 0
> > If IsMissing(Msg) Then > > bInfo.lpszTitle = "Choisir le fichier." > > Else > > bInfo.lpszTitle = Msg > > End If
> > If R Then > > Pos = InStr(path, Chr$(0)) > > GetDirectory = Left(path, Pos - 1) > > Else > > GetDirectory = "" > > End If
> > End Function
> > J'arrive à faire fonctionner ce module mais pas à l'incorporer da ns un > > formulaire
> > Comment faire ???
> > merci- Masquer le texte des messages précédents -
> - Afficher le texte des messages précédents -
une fois que tu as colle dans un module .dans ton formulaire tu cree un bouton et sur l'evenement clik unee procedure evenementiel tu colles :
GetDirectory
A plus- Masquer le texte des messages précédents -
- Afficher le texte des messages précédents -
pour appeler une fonction d'un module , elle n'a pas besoin d'etre public contrairement a une variable
plus
On 30 août, 20:27, "Gilbert" <ZZZgilbert...@NOSPAMlaposte.net> wrote:
Bonjour,
Pour appeler cette fonction d'un formulaire, il te faut la déclarer
publique:
Public Function GetDirectory(Optional Msg) As String
...
...
...
End Function
--
Cordialement,
Gilbert
"MINOT gilles" <gmi...@amada.fr> a écrit dans le message denews:81c04c8 6-7ba6-40f0-aa8b-7c21d6dd1674@p36g2000vbn.googlegroups.com...
On 30 août, 17:31, "3stone" <home@sweet_home.be> wrote:
> Salut,
> Tu dis :
> > J'arrive à faire fonctionner ce module mais pas à l'incorporer da ns un
> > formulaire
> Bizarre... comment tu le fais fonctionner, dans ce cas ;-)
> Colle le dans un module et tu pourras l'appeler de n'importe où...
> > j'ai le code suivant me permettant d'ouvrir un fichier dans access :
> > Option Compare Database
> > Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _
> > Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _
> > ByVal pszPath As String) As Long
> > Public Declare Function SHBrowseForFolder Lib "shell32.dll" _
> > Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
> > Public Type BROWSEINFO
> > hOwner As Long
> > pidlRoot As Long
> > pszDisplayName As String
> > lpszTitle As String
> > ulFlags As Long
> > lpfn As Long
> > lParam As Long
> > iImage As Long
> > End Type
> > Function GetDirectory(Optional Msg) As String
> > Dim bInfo As BROWSEINFO
> > Dim path As String
> > Dim R As Long, X As Long, Pos As Integer
> > bInfo.pidlRoot = 0
> > If IsMissing(Msg) Then
> > bInfo.lpszTitle = "Choisir le fichier."
> > Else
> > bInfo.lpszTitle = Msg
> > End If
> > j'ai le code suivant me permettant d'ouvrir un fichier dans access :
> > Option Compare Database
> > Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _ > > Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _ > > ByVal pszPath As String) As Long
> > Public Declare Function SHBrowseForFolder Lib "shell32.dll" _ > > Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
> > Public Type BROWSEINFO > > hOwner As Long > > pidlRoot As Long > > pszDisplayName As String > > lpszTitle As String > > ulFlags As Long > > lpfn As Long > > lParam As Long > > iImage As Long > > End Type
> > Function GetDirectory(Optional Msg) As String
> > Dim bInfo As BROWSEINFO > > Dim path As String > > Dim R As Long, X As Long, Pos As Integer
> > bInfo.pidlRoot = 0
> > If IsMissing(Msg) Then > > bInfo.lpszTitle = "Choisir le fichier." > > Else > > bInfo.lpszTitle = Msg > > End If