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
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