"Paste-Special" Automation/Command Keys

A

Alex Maghen

Hi. We use various "Paste Special" settings very often and, in Office 2007, I
am trying to support our organization's desire to have these functions
available via Command Keys. I've searched and do not seem to be able to find
Keyboard-Configurable Commands for either "Paste Special" (general) or "Paste
Special Unformatted Unicode Text". I need to provide these as command keys in
all Office 2007 Apps. Do I have to write code to do this? I've tried hard to
search through the millions of settable command keys and cannot find these.

If I'm just missing them, please let me know where I can find them in the
Customization section. If they're not available that way for some reason, can
you point me in the right direction for how I could do this programmatically?

Thanks.

Alex
 
J

Jialiang Ge [MSFT]

Hello Alex,

From your post, my understanding on this issue is: you want to set shortcut
keys for the 'Paste Special' settings. If I'm off base, please feel free to
let me know.

I think we can do it by setting shortcut keys to macros that do the 'Paste
Special'.
Step 1: In the 'Developer' Ribbon of Microsoft Office, choose 'Record
Macro'. Name the macro and press OK.

Step 2: Record the macro: do your 'Paste Special' operations based on the
actual needs. For instance, you click the Paste->Paste Special Ribbon in
Home menu, and choose 'Unformatted Unicode Text'. Office will record all
your behaviors into VBA codes. Finally, click 'Stop Recording' and you will
find the macro's VBA in Microsoft Visual Basic Editor (Alt+F11). For
instance, for 'Unformatted Unicode Text', you will see VBA code:
Selection.PasteSpecial Link:=False, DataType:=20, Placement:=wdInLine,
DisplayAsIcon:=False
You can also refer to the page
http://msdn2.microsoft.com/de-de/library/microsoft.office.interop.word.selec
tion.pasteandformat(VS.80).aspx and
http://msdn2.microsoft.com/de-de/library/microsoft.office.interop.word.wdrec
overytype(VS.80).aspx to learn how to write Select. PasteSpecial without
the macro recorder.
Note: If you only do *ONE* PasteSpecial operation, such as 'Unformatted
Unicode Text', when you record the macro, it is possible that the macro
recorder regards it as your default operation and generates:
Selection.PasteAndFormat (wdPasteDefault). On such cases, you need to
modify the VBA according to the above two MSDN articles.

Step 3: Assign a shortcut key to the macro: Open the 'Word Option' window
by clicking 'Word Options' in Office 2007 menu. Switch to the Customize tab
and click the button Keyboard shortcuts Customize. In the Categories list
of the 'Customize Keyboard' dialog, choose 'Macros', then the macro
recorded in step2 will be listed. Set a shortcut key for the macro and
click 'Close'. The following URL links to a detailed description of how to
assign shortcut keys to macros in Office 2003.
http://wordprocessing.about.com/od/workingwithmacro1/l/blmacrokey.htm

Please let me know if you have any other concerns, or need anything else.

Sincerely,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Steve Rindsberg

Looks like a good solution but note that Alex mentioned *all* Office 2007 apps.
PowerPoint doesn't allow you to assign shortcut keys to macros, unfortunately.

Alex, if PPT becomes an issue, have a look at Chirag Dalal's Shortcut Manager
at http://officeone.mvps.org/

I don't know whether it works with Office 2007 but if so, it might solve the
problem for you.
 
J

Jialiang Ge [MSFT]

Hi Alex,

Would you mind letting me know the result of the suggestions? If you need
further assistance, feel free to let me know. I will be more than happy to
be of assistance.

Have a great day!

Sincerely,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

SandraNoble

i've got Office 2007. Cannot get record feature to work correctly.

As mentioned, and what I experienced,
If I only do *ONE* PasteSpecial operation, it codes it as default:
Selection.PasteAndFormat (wdPasteDefault)

You say
For instance, for 'Unformatted Unicode Text', you will see VBA code:
Selection.PasteSpecial Link:=False, DataType:=20, Placement:=wdInLine,
DisplayAsIcon:=False

That's exactly and only what I want - Paste Special / Unformated Unicode
Text.

I put the exact code above in my macro and I get an error.
Selection.PasteSpecial Link:=False, DataType:=20, Placement:=wdInLine,
DisplayAsIcon:=False

I'd be most grateful for the correct code.

Sandra
President - MBA, CPIM, Six Sigma, DCFS, CDP
blog: http://www.BusinessOver50.com/

NOBLE & ASSOCIATES CONSULTING, INC
http://www.NobleAdvantage.com

NOBLE FINANCE$
http://www.GetCashFromReceivables.com/

*************
 
A

Andy

I also wanted a button for quick access to the Paste Special, Unformatted
Unicode command, I tried to record a macro and it recorded the wrong default
command, then, after googling it, I ended up in this thread.

That command, as you describe, works fine for me. Maybe you are missing the
underscore, if using more than one line. Here's my macro:

Sub Paste_Unicode_Only()
'
' Paste_Unicode_Only Macro
' Macro gravada 15-10-2008 por ...
'
Selection.PasteSpecial Link:=False, DataType:=20, _
Placement:=wdInLine, DisplayAsIcon:=False
End Sub

By the way, I am using Office 2003. If this doesn't work in 2007, then they
changed something in 2007. And I'm using it only for Word.

:

....
 

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