VB ACCESS - Exportation d'une requête avec mot de passe
Fermé
steaker59
Messages postés
47
Date d'inscription
jeudi 28 janvier 2010
Statut
Membre
Dernière intervention
22 décembre 2013
-
16 août 2013 à 15:05
f894009 Messages postés 17192 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 16 juin 2024 - 21 août 2013 à 09:49
f894009 Messages postés 17192 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 16 juin 2024 - 21 août 2013 à 09:49
A voir également:
- VB ACCESS - Exportation d'une requête avec mot de passe
- Piratage facebook changer mot de passe - Guide
- Voir mot de passe wifi android - Guide
- Mot de passe administrateur - Guide
- Mettre un mot de passe sur un dossier - Guide
- Mot de passe oublié outlook - Guide
2 réponses
f894009
Messages postés
17192
Date d'inscription
dimanche 25 novembre 2007
Statut
Membre
Dernière intervention
16 juin 2024
1 708
17 août 2013 à 08:00
17 août 2013 à 08:00
Bonjour,
Protection feuille:
Protection feuille:
Private Sub Commande70_Click() Dim a As String Dim xls As Excel.Application b = Day(Date) & "_" & Month(Date) & "_" & Year(Date) a = Application.CurrentProject.Path & "\export" & b & ".xls" DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "Resultat", a On Error GoTo errHnd Set xls = CreateObject("Excel.Application") xls.Workbooks.Open Application.CurrentProject.Path & "\export" & b & ".xls" xls.Visible = True 'Protection feuille: adaptez le nom de la feuille et le mot de passe xls.Workbooks(b & ".xls").Worksheets("Donnees").Protect Password:="Toto", DrawingObjects:=True, Contents:=True, Scenarios:=True xls.Workbooks(b & ".xls").Worksheets("donnees").EnableSelection = xlNoSelection Exit Sub errHnd: MsgBox "Erreur N° " & Err.Number & vbLf & Err.Description, , Err.Source End Sub
f894009
Messages postés
17192
Date d'inscription
dimanche 25 novembre 2007
Statut
Membre
Dernière intervention
16 juin 2024
1 708
21 août 2013 à 09:49
21 août 2013 à 09:49
Bonjour,
J'ai teste avec ce code (et une base personnelle), ca marche:
A+
J'ai teste avec ce code (et une base personnelle), ca marche:
Private Sub Commande0_Click() Dim a As String Dim xls As Object b = Day(Date) & "_" & Month(Date) & "_" & Year(Date) a = Application.CurrentProject.Path & "\export" & b & ".xls" DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "Resultat", a On Error GoTo errHnd Set xls = CreateObject("Excel.Application") xls.Workbooks.Open Application.CurrentProject.Path & "\export" & b & ".xls" xls.Visible = True 'Protection feuille: adaptez le nom de la feuille et le mot de passe xls.Workbooks(b & ".xls").worksheets("Resultat").Protect Password:="Toto", DrawingObjects:=True, Contents:=True, Scenarios:=True xls.Workbooks(b & ".xls").worksheets("Resultat").EnableSelection = xlNoSelection xls.Quit Set xls = Nothing Exit Sub errHnd: MsgBox "Erreur N° " & Err.Number & vbLf & Err.Description, , Err.Source End Sub
A+
Modifié par steaker59 le 20/08/2013 à 16:00
j'ai essayer votre code il me met que l'indice n'appartient pas à la sélection (erreur n°9)..
Le nom de la feuille à portant bien été remplacé
Pourriez-vous m'orienter ?
20 août 2013 à 17:02
Je vais faire des essais demain matin.
A+