Missing Paste Command

R

Rafael Montserrat

OS 10.4.5
Word 2004

Hi

I was given this Macro code some time ago in order to resolve the "Missing
Paste Command". Now that I am in OS 10 I am trying to install it and I get
error messages:

"Sub PasteUnformattedText()" at the top is highlighted in yellow.

"Paste and Match the Formatting in the Destination Document" is in red type.

One of the articles I am using is HOW TO INSTALL A MACRO by By John McGhie
and Daiya Mitchell, in which it is suggested I go back to the newsgrooup for
a corrected phrasing (?) or help in creating this macro.

Right now, when I do Word>Close and return to word> I get a message:
MICROSOFT VISUAL BASIC "This Command Will Stop The Debugger"

All help appreciated.

Rafael


Sub PasteUnformattedText()
'
' equivalent to Edit>Paste Special>Unformatted Text and to using
' the smart button in Word 2004 to select "keep text only"
'
Selection.PasteSpecial datatype:=wdPasteText
End Sub

Paste and Match the Formatting in the Destination Document

Sub PasteDestFormat()
'
' equivalent to using the paste options smart button in Word 2004 to
' select "match destination formatting" after pasting
'
Selection.PasteAndFormat (wdFormatSurroundingFormattingWithEmphasis)
End Sub
 
J

John McGhie [MVP - Word and Word Macintosh]

Hi Rafael:

You¹re getting a compile error, probably caused by extra characters in the
code. In the code below, the RED line should not be in your code, and the
GREEN line should be a single line.

I tested your code with those changes, and it runs fine here.

If you need to split a line in VBA, use ³space, underscore² at the end of
each line, like this:

Selection.PasteAndFormat _
(wdFormatSurroundingFormattingWithEmphasis)

I try not to split lines, there¹s a dozen ³exceptions² where splitting of
lines is just not allowed under any circumstances :)

Sub PasteUnformattedText()
'
' equivalent to Edit>Paste Special>Unformatted Text and to using
' the smart button in Word 2004 to select "keep text only"
'
Selection.PasteSpecial datatype:=wdPasteText
End Sub

Paste and Match the Formatting in the Destination Document

Sub PasteDestFormat()
'
' equivalent to using the paste options smart button in Word 2004 to
' select "match destination formatting" after pasting
'
Selection.PasteAndFormat(wdFormatSurroundingFormattingWithEmphasis)
End Sub




Sub PasteUnformattedText()
'
' equivalent to Edit>Paste Special>Unformatted Text and to using
' the smart button in Word 2004 to select "keep text only"
'
Selection.PasteSpecial datatype:=wdPasteText
End Sub

Paste and Match the Formatting in the Destination Document

Sub PasteDestFormat()
'
' equivalent to using the paste options smart button in Word 2004 to
' select "match destination formatting" after pasting
'
Selection.PasteAndFormat (wdFormatSurroundingFormattingWithEmphasis)
End Sub

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 (0) 4 1209 1410
 
R

Rafael Montserrat

Hi John,

I went back today to make the correction and to record(?) the macro...put it
in the toolbar ready for use.

But I¹m stuck. I don¹t know if I¹ve got it right below because some thing
got added to the description, and because I don¹t know how to proceed from
here to record the macro, make it a text or icon in the toolbar.

Also, there are three commands, ³PasteUnformattedText², ³PasteDestFormat²,
and now ³Macro1², ³Macro1² having appeared after I did something, not
knowing what I was doing.

I recognize these: ³PasteUnformattedText², ³PasteDestFormat² from the
original ³Paste Special² from ³All Commands². There can also be 4 or 5
other choices in the paste special box.

Anyway I¹m stuck at this point. I know that in the past, before I moved
from OS 9 to OS 10 I got through all this and created the macro. Now I¹ve
forgotton how to complete the process.

Rafael

Below: What¹s now in the VBE(?) window.

And yes. What I got before was a ³compile error².


Sub PasteUnformattedText()
'
' equivalent to Edit>Paste Special>Unformatted Text and to using
' the smart button in Word 2004 to select "keep text only"
'
Selection.PasteSpecial datatype:=wdPasteText
End Sub
Sub PasteDestFormat()
'
' equivalent to using the paste options smart button in Word 2004 to
' select "match destination formatting" after pasting
'
Selection.PasteAndFormat (wdFormatSurroundingFormattingWithEmphasis)
End Sub
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 2/25/06 by Rafael Montserrat
'
Application.Run MacroName:="PasteDestFormat"
ShowVisualBasicEditor = True
End Sub
 

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