Impression en ligne

Fermé
Luteau281 Messages postés 1 Date d'inscription dimanche 13 mars 2016 Statut Membre Dernière intervention 13 mars 2016 - 13 mars 2016 à 16:56
Le Pingou Messages postés 12043 Date d'inscription mercredi 11 août 2004 Statut Contributeur Dernière intervention 25 avril 2024 - 14 mars 2016 à 18:03
bonjour
j'ai besoin d'imprimer un document excel 2 fois par jour. j'ai fait en tache planifiée un fichier excel qui m'imprime mon document. le problème c'est que je n'arrive pas a fermer le fichier cible qui lui reste donc en sous-marin et qui me ralenti mon serveur. si quelqu'un peut m'aider ce serait très sympas
je vous remercie d'avance

voici le script

Private Sub Workbook_Open()
Dim fichier As String
Dim app As Object
Dim book As Workbook
Dim sheet As Worksheet
Set app = CreateObject("excel.Application")
app.DisplayAlerts = False
Set book = app.Workbooks.Open("C:\GESTION\HORIZON\Rapports\96\prevision_gregoire.xlsx")
Set sheet = book.Sheets("famille")
sheet.PrintOut copies:=1, preview:=False, collate:=False
Application.Quit
Set book = Nothing
Set sheet = Nothing
Application.Quit
ActiveWorkbook.Close
End Sub
A voir également:

1 réponse

Le Pingou Messages postés 12043 Date d'inscription mercredi 11 août 2004 Statut Contributeur Dernière intervention 25 avril 2024 1 426
14 mars 2016 à 18:03
Bonjour,
Juste au passage, la fin de la procédure devrait être :

sheet.PrintOut copies:=1, preview:=False, collate:=False 
Set book = Nothing
Set sheet = Nothing
ActiveWorkbook.Close
Application.Quit
End Sub


0