Macro for Pasting unformatted text

G

GREM

I was quite proficient in MS Word for Windows, but I have lots of
problems with Word for Mac. For example, I created without problem a
simple macro in the Windows version for pasting unformatted text. To
create the macro, I would simple record the sequence of clicking on
the menu edit/paste special/paste unformatted. I have tried to do this
in Word for Mac and instead pasting unformatted text, it pastes things
in Lucida Grande when the text being pasted into is a Times New
Roman. Does anyone know why this simple macro fails, why the program
is pasting Lucida Grande (I have no idea why that font is appearing as
it isn't either in the source or the target), and how I can make this
simple macro work? Thank you for any ideas you may have.

(I used to also have a macro where I could paste text and it would
adopt the font/style of the area it was being pasted into, but retain
limited formatting, such as bold, italics, etc. I see no way to do
this in the Mac. If you have suggestions on that, that also would be
of interest, but less essential than the above problem for pasting
unformatted text.)

Bob
 
E

Elliott Roper

GREM said:
I was quite proficient in MS Word for Windows, but I have lots of
problems with Word for Mac. For example, I created without problem a
simple macro in the Windows version for pasting unformatted text. To
create the macro, I would simple record the sequence of clicking on
the menu edit/paste special/paste unformatted. I have tried to do this
in Word for Mac and instead pasting unformatted text, it pastes things
in Lucida Grande when the text being pasted into is a Times New
Roman. Does anyone know why this simple macro fails, why the program
is pasting Lucida Grande (I have no idea why that font is appearing as
it isn't either in the source or the target), and how I can make this
simple macro work? Thank you for any ideas you may have.
You might have posted the macro if you wanted advice from those less
clairvoyant.
Here's mine:
Sub PasteUnformatted()
'
' PasteUnformatted Macro
' Macro recorded 13-08-2004 by Elliott Roper
'
    Selection.PasteSpecial Link:=False, DataType:=wdPasteText,
Placement:= _
        wdInLine, DisplayAsIcon:=False
End Sub

Watch the wrapping. Selection... Placement:=_ is one line.

That will paste text using the style at the destination's insertion
point.

As you can see, it was recorded as you describe.
(I used to also have a macro where I could paste text and it would
adopt the font/style of the area it was being pasted into, but retain
limited formatting, such as bold, italics, etc. I see no way to do
this in the Mac. If you have suggestions on that, that also would be
of interest, but less essential than the above problem for pasting
unformatted text.)

I'd like to know how to do that too.
 
D

Daiya Mitchell

re question 2--
I'd like to know how to do that too.
Well, this should happen automatically if the styles are set up a
certain way. That is, when you paste into a document that has a
different definition for the same style name, the font should
change--but direct formatting like bold/italic/underline should stay.
With just a plain paste/cmd-V. I did a quick test here (word 2004). But
you need identical style names with different definitions for it to
work. This is supposed to be the power of styles--but they've got to be
implemented consistently for it work.

It's not a paste macro, but I imagaine a Find&Replace macro that
switched only the font in a selection would work, after the fact.

But if GREM could share the macro, or the manual steps that created it,
we could see what we can do to replicate it on the Mac.

Daiya
 
D

Daiya Mitchell

Elliott said:
You might have posted the macro if you wanted advice from those less
clairvoyant.
Here's mine:
Sub PasteUnformatted()
'
' PasteUnformatted Macro
' Macro recorded 13-08-2004 by Elliott Roper
As you can see, it was recorded as you describe.

I get something quite different in Word 2004 when I record that sequence:

Selection.PasteAndFormat (wdPasteDefault)

The Paste Special portion of the macro recorder is broken in Word
2004--not sure how many versions that has been in effect. Your date
suggests you recorded it in Word X, Elliott?

The simple macros here will fail without explanation if there isn't
actually text to paste, but do offer another option:
http://word.mvps.org/Mac/PasteText.html

Daiya
 
E

Elliott Roper

Daiya Mitchell said:
I get something quite different in Word 2004 when I record that sequence:

Selection.PasteAndFormat (wdPasteDefault)

The Paste Special portion of the macro recorder is broken in Word
2004--not sure how many versions that has been in effect. Your date
suggests you recorded it in Word X, Elliott?
It probably was Diaya. You might remember how I hung onto v.X for ages
after 2004 came out. ;-) And then there was a fairy godmother...
The simple macros here will fail without explanation if there isn't
actually text to paste, but do offer another option:
http://word.mvps.org/Mac/PasteText.html

mmm Tasty!
I'll definitely have a play with that second version. Thanks.
 
D

Daiya Mitchell

Elliott said:
GREM. It is a good 'un. Just what you wanted.

Daiya. Thanks. It is my new paste unformatted.
You know, I didn't even quite realize that what GREM said is how that
behaved (and I'm still not totally convinced). I do use Paste Matching
Destination a lot more than I use Paste Unformatted--99% of the time it
gets me what I want.

Daiya
 
C

Carl Witthoft

Daiya Mitchell said:
I get something quite different in Word 2004 when I record that sequence:

Selection.PasteAndFormat (wdPasteDefault)

The Paste Special portion of the macro recorder is broken in Word
2004--not sure how many versions that has been in effect. Your date
suggests you recorded it in Word X, Elliott?

The simple macros here will fail without explanation if there isn't
actually text to paste, but do offer another option:
http://word.mvps.org/Mac/PasteText.html

Daiya

I have a macro that works just fine, but of course forgot to send a copy
home :-( . I'll post it tomorrow after retrieving it from my office
computer.
 
C

Carl Witthoft

Carl Witthoft said:
I have a macro that works just fine, but of course forgot to send a copy
home :-( . I'll post it tomorrow after retrieving it from my office
computer.

Ok, here are two. The first was generated in Office2003, windows; the
second in Office2004, OSX

sub pasteunformattedtext

Selection.PasteSpecial Line:=False, DataType:=wdPastetext,
Placement:=wdinLine, DisplayAsIcon:=False
end sub


End Sub

Sub PasteUnformat()
'
' Macro1 Macro
' Macro recorded 8/22/06 by CGW_macman
'
Selection.PasteSpecial datatype:=wdPasteText

End Sub

As an added bonus, here's a handy macro to paste pictures inline with
text. I find it incredily annoying that Word's default is to paste
floating pictures.

Sub PasteInline()
'
' Macro1 Macro
' Macro recorded 8/22/06 by CGW_macman
'
Selection.PasteSpecial datatype:=wdPasteMetafilePicture,
placement:=wdInLine
 
J

John McGhie

Hi Carl:

You need to include a test for an error condition in those so you can
recover gracefully, otherwise the thing will blow up on a runtime error if
the content of the clipboard can't be pasted as text :)

Like this:

Sub PasteUnformatted()
On Error GoTo notAvailable

Selection.PasteSpecial Link:=False, DataType:=20
End

notAvailable:
Selection.Paste

End Sub


Ok, here are two. The first was generated in Office2003, windows; the
second in Office2004, OSX

sub pasteunformattedtext

Selection.PasteSpecial Line:=False, DataType:=wdPastetext,
Placement:=wdinLine, DisplayAsIcon:=False
end sub


End Sub

Sub PasteUnformat()
'
' Macro1 Macro
' Macro recorded 8/22/06 by CGW_macman
'
Selection.PasteSpecial datatype:=wdPasteText

End Sub

As an added bonus, here's a handy macro to paste pictures inline with
text. I find it incredily annoying that Word's default is to paste
floating pictures.

Sub PasteInline()
'
' Macro1 Macro
' Macro recorded 8/22/06 by CGW_macman
'
Selection.PasteSpecial datatype:=wdPasteMetafilePicture,
placement:=wdInLine

--
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, Consultant Technical Writer
McGhie Information Engineering Pty Ltd
http://jgmcghie.fastmail.com.au/
Sydney, Australia. S33°53'34.20 E151°14'54.50
+61 4 1209 1410, mailto:[email protected]
 
C

Carl Witthoft

You're right, I should. But the error is caught by Word, and an error
message window is displayed. No damage to document or application.
 
J

John McGhie

Hi Carl:

You have done enough time on the Help Desk to know that said error provokes
a support call every time from an end user :)

We're supposed to handle this stuff so the end users don't have to :)

Cheers


You're right, I should. But the error is caught by Word, and an error
message window is displayed. No damage to document or application.

--
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, Consultant Technical Writer
McGhie Information Engineering Pty Ltd
http://jgmcghie.fastmail.com.au/
Sydney, Australia. S33°53'34.20 E151°14'54.50
+61 4 1209 1410, 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