Paste special in PP2000

L

Luut

Hello.

Can anyone tell me how to program a macro in VBA that has
the Paste special option? When I record 'paste special as
unformatted text' in a macro, nothing shows up in the
macro sub code field in VBA. I made a toolbar in VBA with
a lot of handy thingy's for me. I like to have a button
that does the following: select the menu item edit, paste
special, unformatted text. My work requires a lot of
special pasting as unformatted text and a macro that would
do those all the menu actions and clicking to achieve this
would be a great help! I searched on the net already and
read that the PowerPoint Object Model does not support
special pasting. There is a trick to achieve it by using
the Word Object Model (see the following link:
http://support.microsoft.com/default.aspx?scid=kb;en-
us;222721&Product=ppt2000 ) but the sub code that is
described generated nothing but errors in my VBA module.

Is there another way to achieve a paste special macro in
PowerPoint 2000?

Greetz, Buzz.
 
L

Luut

Hey Glen.

That's exactly the same code as in the microsoft article.
It functions now and I replaced the
wdPasteEnhancedMetafile with wdPasteText. But it pastes
the text as a new textbox in PP. I want it to paste the
unformatted text into a textbox that I selected or replace
it with the text I selected in a text box in PP. The text
that is being pasted has to get the same properties of the
text that is already in the textbox. Example: I have a
textbox with the text "Title" in it. This text(box) has
properties like 24 pt font, Arial, 1 line spacing, margin
setting, fontcolour settings, not bold, etc. The following
step is that I <Ctrl-V> text with whole different
properties (like font= Verdana, 10 pt, black and bold)
from a Word or other PP document, go to the textbox or
text in PP that has the precise set of properties that I
need, click the macro so that the copied text is
transferred into the textbox or replace the text I
selected. I realize that is has something to do that the
code has to detect if I selected text or a textbox and put
the text that is in memory as unformatted text in my
selected textbox, thus getting the properties of that text
or textbox. Pfewww, am I being clear? It's hard to explain
for a Dutchman, I apologize.

Greetz, Buzz.
 
G

Glen Millar

Hi,

You are perfectly clear <g>. Unfortunately I'm no vba guru to want to muck
too much. Steve! Shyam! Mom! Help, please!

--
Regards,

Glen Millar
Microsoft PPT MVP
http://www.powerpointworkbench.com/
Please tell us your ppt version, and get back to us here
Remove spaces from signature
 
S

Shyam Pillai

Luut,
Are you looking to do something like this?

1. Copy the text to the clipboard.
2. Select the target PowerPoint shape or text selections where it has to be
pasted.
3. Run this macro

ActiveWindow.Selection.ShapeRange.PickUp
ActiveWindow.Selection.TextRange.Paste
ActiveWindow.Selection.ShapeRange.Apply

--
Regards
Shyam Pillai

Toolbox for PowerPoint
http://www.mvps.org/skp/toolbox


It would be simpler to pick up the text properties of the texbox into
 
L

luut

Shyam, you're the best!

-----Original Message-----
Luut,
Are you looking to do something like this?

1. Copy the text to the clipboard.
2. Select the target PowerPoint shape or text selections where it has to be
pasted.
3. Run this macro

ActiveWindow.Selection.ShapeRange.PickUp
ActiveWindow.Selection.TextRange.Paste
ActiveWindow.Selection.ShapeRange.Apply

--
Regards
Shyam Pillai

Toolbox for PowerPoint
http://www.mvps.org/skp/toolbox


It would be simpler to pick up the text properties of the texbox into



.
 
L

Luut

Hey Shyam.

There's a little new bug. I want a failsafe built in as I
have in my other buttons. At first when the sub runs, it
checks whether a presentation is open. If so continue with
the sub. If not, end the sub. This failsafe I have
already. Your code works perfect as long as there is
something in the clipboard. I want to perfect it. The next
step is that the sub has to check if there's anything on
the clipboard. I tried several things but all give errors.
I suspect that it has to do something with .count. If
there's nothing there the a MsgBox will display "There's
nothing in the clipboard." But if there's something there
it has to check if it has text (.hasText) or it's
something else. In the case it's no text, the sub will
show an Msgbox "you can only paste text." And the sub will
end. If the clipboard contains text, then your code (.
pickup, paste, apply) will be executed and the sub ends.
So can you help me out with the code for checking if
there's something in the clipboard and checking if it
contains text. Here's the sub till so far. I removed all
my tryouts, you'd probably would laugh you ass of if you
saw them :)

----------

Sub PowerPointPasteSpecial()

OpenPresentatie = Application.Windows.Count
If OpenPresentatie >= 1 Then

'ActiveWindow.Selection.ShapeRange.PickUp
'ActiveWindow.Selection.TextRange.Paste
'ActiveWindow.Selection.ShapeRange.Apply

Else
MsgBox "Er is geen presentatie open.",
vbExclamation, "'Paste als unformatted text."
End If

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