Matz848
Matz848

Reputation: 23

How to Clear the MS Office Clipboard using VBA code converted to VBS

I wanna do a simple script that clears the MS Office Clipboard using some VBA code adapted to VBS code.

I Tried this:

Dim XLapp Set XLapp = CreateObject("Excel.Application")

XLapp.CutCopyMode=False

didnt work!

Upvotes: 0

Views: 261

Answers (1)

TinMan
TinMan

Reputation: 7759

If you are going to writing VBScript then you should download VbsEdit. It is free to use but well worth the price if you are going to be writing a lot of scripts. It also comes with HTAEdit.

VbsEdit Screenshot

VbsEdit Local Window Screenshot

Using the sample script you can clear the ClipBoard like this:

Dim toolkit
Set toolkit = CreateObject("vbsedit.toolkit")
toolkit.PutClipboardText ""

Or simple

CreateObject("vbsedit.toolkit").PutClipboardText ""

Note: you can not create a DataObject in VBScript. CreateObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}") will work in VBA but will fail in VBScript.

Upvotes: 0

Related Questions