How can I clear the clipboard using (Word) VBA? I’m using these lines of code to copy text from one doc to another (based on the same template, so the sections match):
For each sec in DocSource.Sections
If sec.ProtectedForForms = False Then
Set rngDocSource = Sec.Range
rngDocSource.Copy
Set rngDocTarget = DocTarget.Sections(sec.Index).Range
rngDocTarget.Paste
‘Clear clipboard here
End If
Next sec
Sometimes a section doesn’t contain any text and an error 4605 occurs. So at first, in my errorhandler I tested for this error and then proceded with Resume Next. But that means that the content of the previous section – still on the clipboard – will be pasted. Hence the need for clearing the clipboard. But I cannot find out how…
I tried searching the Lounge, but all I found was the old post 255992 with the advice to use an API. But unfortunately that didn’t work.