"Missing Paste Command" instruction

R

raf44ael98

Hi John,

I had to go back and get this "Missing Paste Command" instruction. I
selected what's here in the newsgroup text, copied, and pasted into a
word document. But the result confuses me. What I selected and pasted
into Word, pastes without spaces between certain lines, like this.

Selection.PasteSpecial datatype:=wdPasteText
End Sub
Paste and Match the Formatting in the Destination Document
Sub PasteDestFormat()

I think it's supposed to look like what's below, with a space between
End Sub … Paste and … Sub PasteDes …. In other words, "Paste and Match
the Formatting in the Destination Document" is just a title, right?
It's not at all part of the macro is it? "End Sub" is the very end of
a macro, and a macro doesn't start until: "Sub". The title is only
that, a title, having nothing to do with the code. Am I right?
Thanks, Rafael

Selection.PasteSpecial datatype:=wdPasteText
End Sub

Paste and Match the Formatting in the Destination Document

Sub PasteDestFormat()




---------- Forwarded message ----------
From: Rafael Montserrat <[email protected]>
Date: Feb 25 2006, 12:16 pm
Subject: Missing Paste Command
To: microsoft.public.mac.office.word


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

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
 
J

John McGhie

Hi Rafael:

Yes, you are correct.

Each macro must begin with:

Sub MacroName()

On a line by itself, and end with:

End Sub

Also on a line by itself.

When copy-pasting from anything that displays HTML, it saves a lot of time
if you first paste the text into a text editor (e.g. TextEdit, but you need
to remember to do Format>Make Plain Text) and then copy THAT and paste it
into the Visual Basic Editor.

HTML has some arcane rules about the treatment of spaces, which confuse the
VBA compiler into producing compile errors.

Cheers


Hi John,

I had to go back and get this "Missing Paste Command" instruction. I
selected what's here in the newsgroup text, copied, and pasted into a
word document. But the result confuses me. What I selected and pasted
into Word, pastes without spaces between certain lines, like this.

Selection.PasteSpecial datatype:=wdPasteText
End Sub
Paste and Match the Formatting in the Destination Document
Sub PasteDestFormat()

I think it's supposed to look like what's below, with a space between
End Sub ¡¦ Paste and ¡¦ Sub PasteDes ¡¦. In other words, "Paste and Match
the Formatting in the Destination Document" is just a title, right?
It's not at all part of the macro is it? "End Sub" is the very end of
a macro, and a macro doesn't start until: "Sub". The title is only
that, a title, having nothing to do with the code. Am I right?
Thanks, Rafael

Selection.PasteSpecial datatype:=wdPasteText
End Sub

Paste and Match the Formatting in the Destination Document

Sub PasteDestFormat()




---------- Forwarded message ----------
From: Rafael Montserrat <[email protected]>
Date: Feb 25 2006, 12:16 pm
Subject: Missing Paste Command
To: microsoft.public.mac.office.word


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

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 
R

Rafael Montserrat

Hi John,

My apologies for not getting back to you. I have serious computer problems
which I hope to solve soon with some help. I'll be back when this whole
thing is working again.

Best, Rafael
 
J

John McGhie

Hi Rafael:

Thanks. Hope you get it sorted out soon (and break the fingers of the
miscreant who cased them!). Cheers


Hi John,

My apologies for not getting back to you. I have serious computer problems
which I hope to solve soon with some help. I'll be back when this whole
thing is working again.

Best, Rafael

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 

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