View Single Post
  #10   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default automatically delete text in clipboard on exit

I apologize profusely. I missed a step that's required for this macro, but not
generally for most macros.

The line that says "Dim MyData As DataObject" refers to a type of object that
isn't built into Word. To make it available, do this:

- Open the macro editor and double-click the module in the Normal.dotm template
that contains the AutoClose macro.

- Click the Tools menu (in the macro editor, not in Word itself) and choose
References.

- In the resulting dialog, scroll down the list to "Microsoft Forms 2.0 Object
Library" and click its check box to activate it.

- Save, then close the macro editor.

You should no longer get the error message, and the clipboard should
automatically be cleared -- no button or shortcut needed.

On Fri, 5 Jun 2009 03:13:01 -0700, Stephen
wrote:


Hi,

Because your website says "Idiot's Guide to Installing Macros" I felt I was
qualified so I gave it a try. But I seem to be an even bigger Idiot than
most because I apparently did something wrong.

I know I didn't add the macro to the toolbar because, unfortunately, I have
2007. I also didn't add a shortcut or add the macro to the Quick Access
Toolbar because I figure if I have to click a shortcut or the toolbar every
time, it seems the same to me as clicking the dialogue box. I was hoping it
would run automatically on exit. If it isn't supposed to run automatically,
thanks anyway for trying. If it is suppose to run automatically, then I
obviously did something wrong.

When I try to exit now, I get a Microsoft Visual Basic box that says:
"Compile error: User-defined type not defined."

I, of course, have no clue what this means but possibly someone else does.

Thanks,

Stephen

"Jay Freedman" wrote:

On Sat, 30 May 2009 02:56:00 -0700, Stephen
wrote:

Hi,

Every time I exit Word 2007, I get a box that asks me if I want to keep the
text in the clipboard for other applications. I never want to keep the text
in the clipboard, so does anyone possibly know of some way that I can tick
some box so that I'll never be asked that again.

Thanks for any help.

Stephen


There's no way to "tick some box" to turn off the prompts. You need a macro to
clear the clipboard before exiting from Word. Put this macro into a module in
the Normal.dotm template (see http://www.gmayor.com/installing_macro.htm if
needed):

Sub AutoClose()
Dim MyData As DataObject
If Documents.Count 2 Then
' clear clipboard
Set MyData = New DataObject
MyData.SetText ""
MyData.PutInClipboard
Set MyData = Nothing
End If
End Sub


--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.