importer dossiers publics outlook

steeeve34

XLDnaute Nouveau
Bonjour,

J'ai une macro qui me permet de prendre une feuille d'un classeur excel à un autre classeur. Cette macro fonctionne très bien avec mon fichier test le seul problème c'est qu'avec mon vrai fichier le classeur où je dois aller chercher une certaine feuille se trouve dans les dossiers publics sur outlook. Voici ma macro fonctionnelle:

Private Sub CommandButton1_Click()
Dim sPath As String, sFic As String
Dim ShtS As Worksheet
' On teste la saisie du nom ... If Me.txtNom.Text = "" Then
If Me.txtNoJob.Text = "" Then
MsgBox "Vous devez entrer un No.Job."
Me.txtNoJob.SetFocus
Exit Sub
End If

GoTo Suite
' On teste la saisie du prénom ... If Me.txtPrenom.Text = "" Then
If Me.txtClient.Text = "" Then
MsgBox "Vous devez entrer un nom de client."
Me.txtClient.SetFocus
Exit Sub
End If
If Me.txtModele.Text = "" Then
MsgBox "Vous devez entrer un numéro de modèle."
Me.txtModele.SetFocus
Exit Sub
End If
If Me.txtPrepare.Text = "" Then
MsgBox "Vous devez entrer votre nom."
Me.txtPrepare.SetFocus
Exit Sub
End If
If Me.txtDate.Text = "" Then
MsgBox "Vous devez entrer la date."
Me.txtDate.SetFocus

Exit Sub
End If
Sheets("RAPPORT").Range("D3").Value = Me.txtNoJob.Text
Sheets("RAPPORT").Range("D4").Value = Me.txtClient.Text
Sheets("RAPPORT").Range("D5").Value = Me.txtModele.Text
Sheets("RAPPORT").Range("D6").Value = Me.txtPrepare.Text
Sheets("RAPPORT").Range("I6").Value = Me.txtDate.Text
Suite:
' Définir le chemin d'accès au fichier ainsi que son nom
sPath = ThisWorkbook.Path & "\"
sFic = Me.txtNoJob & ".xlsx"
' Copier la feuille du classeur correspondant
Workbooks.Open sPath & sFic
ActiveWorkbook.Sheets("TABLEMAT").Cells.Copy
ThisWorkbook.Sheets("TABLEMAT").Paste
Application.CutCopyMode = False
ActiveWorkbook.Close
' Fermer l'userform
Unload Me
End Sub
 

Pièces jointes

  • 105 Hydro One 400-46.zip
    7.6 KB · Affichages: 36
  • RAPPORT.zip
    20.7 KB · Affichages: 28
  • RAPPORT.zip
    20.7 KB · Affichages: 25
  • RAPPORT.zip
    20.7 KB · Affichages: 26

Discussions similaires

Réponses
1
Affichages
249

Statistiques des forums

Discussions
312 317
Messages
2 087 189
Membres
103 493
dernier inscrit
Vidal Salvador