Gruppe
Druck
Problem
Wie kann ich über VBA eine Arbeitsmappe öffnen, das erste Blatt drucken und die Mappe wieder schließen, ohne daß sie angezeigt wird?
StandardModule: basMain
Sub OeffnenDruckenSchliessen()
Dim vFile As Variant
Application.ScreenUpdating = False
Application.EnableEvents = False
On Error GoTo ERRORHANDLER
vFile = Application.GetOpenFilename( _
"Excel-Arbeitsmappe (*.xls), *.xls")
If vFile = False Then GoTo ERRORHANDLER
Workbooks.Open vFile
Worksheets(1).PrintOut
ActiveWorkbook.Close savechanges:=False
ERRORHANDLER:
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub