Bonjour,
Sur Access, j'ouvre en VBA un fichier excel défini (toto.xls) sur un
serveur.
je souhaite que l'utilisateur n'ai pas acces au menu ni à tout autre bouton.
de façon à ce qu'il puisse seulement modifier, et enregistrer
ce fichier et seulement ce fichier.(sans pouvoir en ouvrir d'autre)
Est ce possible?
Cordialement
LrD
Bonjour,
Sur Access, j'ouvre en VBA un fichier excel défini (toto.xls) sur un
serveur.
je souhaite que l'utilisateur n'ai pas acces au menu ni à tout autre bouton.
de façon à ce qu'il puisse seulement modifier, et enregistrer
ce fichier et seulement ce fichier.(sans pouvoir en ouvrir d'autre)
Est ce possible?
Cordialement
LrD
Bonjour,
Sur Access, j'ouvre en VBA un fichier excel défini (toto.xls) sur un
serveur.
je souhaite que l'utilisateur n'ai pas acces au menu ni à tout autre bouton.
de façon à ce qu'il puisse seulement modifier, et enregistrer
ce fichier et seulement ce fichier.(sans pouvoir en ouvrir d'autre)
Est ce possible?
Cordialement
LrD
Bonjour,
c'est possible en pilotant Excel depuis Access et en interdisant toutes
les barres de commande et le double click sur l'espace de barre de
commande et enfin en créeant ta propre barre de commandes personnalisée.
Par ailleurs, il faudra supprimer les possibilités de fermeture de la
barre d'application d'Excel.
Pour toutes ces possibilités en dehors de l'interdiction du double
click, si tu parcours le site de Frédéric Sigonneau aux items Barre
d'outils et Excel et Bricolos , tu trouveras tous les exmples possibles
que tu peux adapter à tes souhaits.
Pour le double click , je te propose la proc suivante due à Alain CROS
qui fonctionne très bien au moisn en Excel 2000 avec win XP ou 2000.
Dans le module ThisWorkbook
Private Sub Workbook_BeforeClose(Cancel As Boolean)
LeHook
End Sub
Private Sub Workbook_Open()
LeHook True
End Sub
Dans un module ordinaire
Private Declare Function LockWindowUpdate& Lib "user32" ( _
ByVal hwndLock&)
Private Declare Function PostMessage& Lib "user32" _
Alias "PostMessageA" (ByVal hwnd&, ByVal wMsg&, ByVal wParam&, ByVal
lParam&)
Private Declare Function FindWindowEx& Lib "user32" _
Alias "FindWindowExA" (ByVal hWnd1&, ByVal hWnd2&, ByVal lpsz1$,
ByVal lpsz2$)
Private Declare Function GetWindowLong& Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd&, ByVal nIndex&)
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function SetWindowsHookEx& Lib "user32" _
Alias "SetWindowsHookExA" (ByVal idHook&, ByVal lpfn&, ByVal hmod&,
ByVal dwThreadId&)
Private Declare Function GetWindowText& Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd&, ByVal lpString$, ByVal cch&)
Private Declare Function UnhookWindowsHookEx& Lib "user32" _
(ByVal hHook&)
Private lgHook&
Sub LeHook(Optional cache As Boolean)
Const GWL_HINSTANCE& = -6
If cache Then
InstallHook GetWindowLong(FindWindowEx(0&, 0&, "XLMAIN", _
Application.Caption), GWL_HINSTANCE)
Else
UnhookWindowsHookEx lgHook
End If
End Sub
Sub InstallHook(lgInst&)
Const WH_CBT& = &H5
#If VBA6 Then
lgHook = SetWindowsHookEx(WH_CBT, AddressOf WinHook, _
lgInst, GetCurrentThreadId)
#Else
lgHook = SetWindowsHookEx(WH_CBT, AddrOf("WinHook"), _
lgInst, GetCurrentThreadId)
#End If
End Sub
Private Function WinHook&(ByVal lMsg&, ByVal wParam&, ByRef lParam&)
Const HCBT_ACTIVATE& = &H5, WM_SYSCOMMAND& = &H112, SC_CLOSE& = &HF060&
Dim MYSTR$
If lMsg = HCBT_ACTIVATE Then
LockWindowUpdate wParam
MYSTR = Space$(100&)
MYSTR = Left$(MYSTR, GetWindowText(wParam, MYSTR, 100&))
If MYSTR = "Personnaliser" Or MYSTR = "Personnalisation" Then
PostMessage wParam, WM_SYSCOMMAND, SC_CLOSE, 0&
Else
LockWindowUpdate False
End If
End If
WinHook = False
End Function
Cependant, bien que ta demande soit possible, ne vaudrait il mieux pas
effectuer toutes les manips dans Access par un formulaire , et via une
connexion DAO mettr à jour le fichier Excel ?
A+Bonjour,
Sur Access, j'ouvre en VBA un fichier excel défini (toto.xls) sur un
serveur.
je souhaite que l'utilisateur n'ai pas acces au menu ni à tout autre
bouton.
de façon à ce qu'il puisse seulement modifier, et enregistrer
ce fichier et seulement ce fichier.(sans pouvoir en ouvrir d'autre)
Est ce possible?
Cordialement
LrD
Bonjour,
c'est possible en pilotant Excel depuis Access et en interdisant toutes
les barres de commande et le double click sur l'espace de barre de
commande et enfin en créeant ta propre barre de commandes personnalisée.
Par ailleurs, il faudra supprimer les possibilités de fermeture de la
barre d'application d'Excel.
Pour toutes ces possibilités en dehors de l'interdiction du double
click, si tu parcours le site de Frédéric Sigonneau aux items Barre
d'outils et Excel et Bricolos , tu trouveras tous les exmples possibles
que tu peux adapter à tes souhaits.
Pour le double click , je te propose la proc suivante due à Alain CROS
qui fonctionne très bien au moisn en Excel 2000 avec win XP ou 2000.
Dans le module ThisWorkbook
Private Sub Workbook_BeforeClose(Cancel As Boolean)
LeHook
End Sub
Private Sub Workbook_Open()
LeHook True
End Sub
Dans un module ordinaire
Private Declare Function LockWindowUpdate& Lib "user32" ( _
ByVal hwndLock&)
Private Declare Function PostMessage& Lib "user32" _
Alias "PostMessageA" (ByVal hwnd&, ByVal wMsg&, ByVal wParam&, ByVal
lParam&)
Private Declare Function FindWindowEx& Lib "user32" _
Alias "FindWindowExA" (ByVal hWnd1&, ByVal hWnd2&, ByVal lpsz1$,
ByVal lpsz2$)
Private Declare Function GetWindowLong& Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd&, ByVal nIndex&)
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function SetWindowsHookEx& Lib "user32" _
Alias "SetWindowsHookExA" (ByVal idHook&, ByVal lpfn&, ByVal hmod&,
ByVal dwThreadId&)
Private Declare Function GetWindowText& Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd&, ByVal lpString$, ByVal cch&)
Private Declare Function UnhookWindowsHookEx& Lib "user32" _
(ByVal hHook&)
Private lgHook&
Sub LeHook(Optional cache As Boolean)
Const GWL_HINSTANCE& = -6
If cache Then
InstallHook GetWindowLong(FindWindowEx(0&, 0&, "XLMAIN", _
Application.Caption), GWL_HINSTANCE)
Else
UnhookWindowsHookEx lgHook
End If
End Sub
Sub InstallHook(lgInst&)
Const WH_CBT& = &H5
#If VBA6 Then
lgHook = SetWindowsHookEx(WH_CBT, AddressOf WinHook, _
lgInst, GetCurrentThreadId)
#Else
lgHook = SetWindowsHookEx(WH_CBT, AddrOf("WinHook"), _
lgInst, GetCurrentThreadId)
#End If
End Sub
Private Function WinHook&(ByVal lMsg&, ByVal wParam&, ByRef lParam&)
Const HCBT_ACTIVATE& = &H5, WM_SYSCOMMAND& = &H112, SC_CLOSE& = &HF060&
Dim MYSTR$
If lMsg = HCBT_ACTIVATE Then
LockWindowUpdate wParam
MYSTR = Space$(100&)
MYSTR = Left$(MYSTR, GetWindowText(wParam, MYSTR, 100&))
If MYSTR = "Personnaliser" Or MYSTR = "Personnalisation" Then
PostMessage wParam, WM_SYSCOMMAND, SC_CLOSE, 0&
Else
LockWindowUpdate False
End If
End If
WinHook = False
End Function
Cependant, bien que ta demande soit possible, ne vaudrait il mieux pas
effectuer toutes les manips dans Access par un formulaire , et via une
connexion DAO mettr à jour le fichier Excel ?
A+
Bonjour,
Sur Access, j'ouvre en VBA un fichier excel défini (toto.xls) sur un
serveur.
je souhaite que l'utilisateur n'ai pas acces au menu ni à tout autre
bouton.
de façon à ce qu'il puisse seulement modifier, et enregistrer
ce fichier et seulement ce fichier.(sans pouvoir en ouvrir d'autre)
Est ce possible?
Cordialement
LrD
Bonjour,
c'est possible en pilotant Excel depuis Access et en interdisant toutes
les barres de commande et le double click sur l'espace de barre de
commande et enfin en créeant ta propre barre de commandes personnalisée.
Par ailleurs, il faudra supprimer les possibilités de fermeture de la
barre d'application d'Excel.
Pour toutes ces possibilités en dehors de l'interdiction du double
click, si tu parcours le site de Frédéric Sigonneau aux items Barre
d'outils et Excel et Bricolos , tu trouveras tous les exmples possibles
que tu peux adapter à tes souhaits.
Pour le double click , je te propose la proc suivante due à Alain CROS
qui fonctionne très bien au moisn en Excel 2000 avec win XP ou 2000.
Dans le module ThisWorkbook
Private Sub Workbook_BeforeClose(Cancel As Boolean)
LeHook
End Sub
Private Sub Workbook_Open()
LeHook True
End Sub
Dans un module ordinaire
Private Declare Function LockWindowUpdate& Lib "user32" ( _
ByVal hwndLock&)
Private Declare Function PostMessage& Lib "user32" _
Alias "PostMessageA" (ByVal hwnd&, ByVal wMsg&, ByVal wParam&, ByVal
lParam&)
Private Declare Function FindWindowEx& Lib "user32" _
Alias "FindWindowExA" (ByVal hWnd1&, ByVal hWnd2&, ByVal lpsz1$,
ByVal lpsz2$)
Private Declare Function GetWindowLong& Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd&, ByVal nIndex&)
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function SetWindowsHookEx& Lib "user32" _
Alias "SetWindowsHookExA" (ByVal idHook&, ByVal lpfn&, ByVal hmod&,
ByVal dwThreadId&)
Private Declare Function GetWindowText& Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd&, ByVal lpString$, ByVal cch&)
Private Declare Function UnhookWindowsHookEx& Lib "user32" _
(ByVal hHook&)
Private lgHook&
Sub LeHook(Optional cache As Boolean)
Const GWL_HINSTANCE& = -6
If cache Then
InstallHook GetWindowLong(FindWindowEx(0&, 0&, "XLMAIN", _
Application.Caption), GWL_HINSTANCE)
Else
UnhookWindowsHookEx lgHook
End If
End Sub
Sub InstallHook(lgInst&)
Const WH_CBT& = &H5
#If VBA6 Then
lgHook = SetWindowsHookEx(WH_CBT, AddressOf WinHook, _
lgInst, GetCurrentThreadId)
#Else
lgHook = SetWindowsHookEx(WH_CBT, AddrOf("WinHook"), _
lgInst, GetCurrentThreadId)
#End If
End Sub
Private Function WinHook&(ByVal lMsg&, ByVal wParam&, ByRef lParam&)
Const HCBT_ACTIVATE& = &H5, WM_SYSCOMMAND& = &H112, SC_CLOSE& = &HF060&
Dim MYSTR$
If lMsg = HCBT_ACTIVATE Then
LockWindowUpdate wParam
MYSTR = Space$(100&)
MYSTR = Left$(MYSTR, GetWindowText(wParam, MYSTR, 100&))
If MYSTR = "Personnaliser" Or MYSTR = "Personnalisation" Then
PostMessage wParam, WM_SYSCOMMAND, SC_CLOSE, 0&
Else
LockWindowUpdate False
End If
End If
WinHook = False
End Function
Cependant, bien que ta demande soit possible, ne vaudrait il mieux pas
effectuer toutes les manips dans Access par un formulaire , et via une
connexion DAO mettr à jour le fichier Excel ?
A+Bonjour,
Sur Access, j'ouvre en VBA un fichier excel défini (toto.xls) sur un
serveur.
je souhaite que l'utilisateur n'ai pas acces au menu ni à tout autre
bouton.
de façon à ce qu'il puisse seulement modifier, et enregistrer
ce fichier et seulement ce fichier.(sans pouvoir en ouvrir d'autre)
Est ce possible?
Cordialement
LrD
Sur le site de frédéric Sigonneau, j'ai trouvé ceci:
Sub Désactive()
Dim K, I As Integer
On Error Resume Next
For Each K In Array("^", "%", "+^", "+%", "^%", "+^%")
For I = 32 To 255
Application.OnKey K & Chr$(I), ""
Next I
Next K
End Sub
Sub Réactive()
Dim K, I As Integer
On Error Resume Next
For Each K In Array("^", "%", "+^", "+%", "^%", "+^%")
For I = 32 To 255
Application.OnKey K & Chr$(I)
Next I
Next K
End Sub
Merci,
Sur le site de frédéric Sigonneau, j'ai trouvé ceci:
Sub Désactive()
Dim K, I As Integer
On Error Resume Next
For Each K In Array("^", "%", "+^", "+%", "^%", "+^%")
For I = 32 To 255
Application.OnKey K & Chr$(I), ""
Next I
Next K
End Sub
Sub Réactive()
Dim K, I As Integer
On Error Resume Next
For Each K In Array("^", "%", "+^", "+%", "^%", "+^%")
For I = 32 To 255
Application.OnKey K & Chr$(I)
Next I
Next K
End Sub
Merci,
Sur le site de frédéric Sigonneau, j'ai trouvé ceci:
Sub Désactive()
Dim K, I As Integer
On Error Resume Next
For Each K In Array("^", "%", "+^", "+%", "^%", "+^%")
For I = 32 To 255
Application.OnKey K & Chr$(I), ""
Next I
Next K
End Sub
Sub Réactive()
Dim K, I As Integer
On Error Resume Next
For Each K In Array("^", "%", "+^", "+%", "^%", "+^%")
For I = 32 To 255
Application.OnKey K & Chr$(I)
Next I
Next K
End Sub
Merci,