Macro in Word, deleted, is pasting text into inappropriate places

  • Thread starter Perplexed in Vancouver
  • Start date
P

Perplexed in Vancouver

I copied a macro to quickly paste text unformatted into MS Word2003 and
assigned it to my keyboard (Crtl + Alt + V). But then strange things started
happening. Each time I open a document, the macro appears as text in the new
document (see first example below). If I go to save a file for the first
time, the proposed name for the file is the first line of the macro (see
second example below). So I deleted the macro - but it is still happening.
Suggestions?

Here's the macro I used:

Sub Acleanpaste()
'
' Acleanpaste Macro
' Macro created 10/03/2009 by XYZ
'
On Error GoTo Oops
Selection.PasteSpecial _
DataType:=wdPasteText, _
Placement:=wdInLine
End
Oops:
Beep
End Sub

EX 1) If I open a new document, here is what appears:

Sub PasteUnfText()
Sub PasteUnfText()
On Error GoTo Oops
Selection.PasteSpecial _
DataType:=wdPasteText, _
Placement:=wdInLine
End
Oops:
Beep
End SubOn Error GoTo Oops
Selection.PasteSpecial _
Sub PasteUnfText()
On Error GoTo Oops
Selection.PasteSpecial _
DataType:=wdPasteText, _
Placement:=wdInLine
End
Oops:
Beep
End SubDataType:=wdPasteText, _
Placement:=wdInLine
End
Oops:
Beep
End Sub

EX 2) If I go to save a document, even after deleting the unwanted macro
that pasted itself in, I get a proposed file name of:

Sub PasteUnfText
 
L

Lene Fredborg

It sounds as if you have somehow got text pasted into your Normal.dot and not
as a problem with the macro. See:
http://word.mvps.org/FAQs/AppErrors/BlankDocNotBlank.htm

About the suggested file name:
When you save a document for the first time, Word will suggest the first
words of the document as the file name if the Title field in the Properties
dialog box is empty. Therefore, if the macro text is in the document when you
try to save, Word picks up the macro name as the suggested name. If the file
name is also suggested _after_ you have deleted the macro text, it indicates
that the text has been stored in the Title field in your Normal.dot
(Properties dialog box > Summary tab). In that case: when opening and
deleting the contents from Normal.dot as described in the above article, also
clear the Title field.

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top