Geacht forum,
Onderstaande code probeert elk document te sluiten, maar sluit er maat één.
Graag uw hulp.
Met vriendelijke groet,
Ruud.
Onderstaande code probeert elk document te sluiten, maar sluit er maat één.
Code:
Dim sDesktop As String
Dim windowsScriptShell As Object
Set windowsScriptShell = CreateObject("WScript.Shell")
sDesktop = windowsScriptShell.SpecialFolders("Desktop")
Dim sApp As Object
Dim doc As Object
Set sApp = GetObject(, "Word.Application")
If sApp Is Nothing Then
Else
sApp.Visible = True
sApp.Activate
For Each doc In sApp.Documents
doc.SaveAs (sDesktop & "\" & Format(Date, "yyyymmdd") & doc.Name)
doc.Close
Set sApp = Nothing
On Error Resume Next
Set sApp = GetObject(, "Word.Application")
On Error GoTo 0
Next doc
Set doc = Nothing
sApp.Quit
End If
Graag uw hulp.
Met vriendelijke groet,
Ruud.