Dear Loungers,
I want to interrupt the Paste command and use Paste Special instead. Because what is being pasted varies I wnat to choose the method of pasting.
thanks liz
Dear Loungers,
I want to interrupt the Paste command and use Paste Special instead. Because what is being pasted varies I wnat to choose the method of pasting.
thanks liz

This month, every Windows Secrets subscriber can download a one-chapter excerpt of Windows 7: The Missing Manual.Windows 7: The Missing Manual provides valuable information to help you overcome these difficulties in learning a new operating system. Subscribe today to download your free excerpt.
You could select Tools | Customize... and remove the Paste item from the Edit menu and from the Standard toolbar. Then add Paste Special... from the Edit category to the Standard toolbar and change it to look the way you like. That way, both menu and toolbar would only have the Paste Special... item. But Ctrl+V would still execute the Paste command.
If you really want to replace Paste entirely, you can create a macro named EditPaste in a module in your Normal.dot:
Sub EditPaste()
On Error GoTo ErrHandler
Application.Dialogs(wdDialogEditPasteSpecial).Show
Exit Sub
ErrHandler:
Select Case Err
Case 4605
' can't paste - ignore
Case Else
MsgBox Err.Description, vbExclamation
End Select
End Sub
But I don't think it would be a good idea to do this - it would very quickly become annoying. Better to have both Paste and Paste Special available.
Hans
Thkyou/ Yes, I am nervous about doing this but the situation that the template will be used in is very particular and I think, in these circumstances it will be fine. I am trying to persuad the clinet to have a Paste Unformatted Text and a Paste Picture menu option or button but he is adamant!
I don't tink this traps the user selecting Cancel does it so I should add that?
Thnak you..... liz
Application.Dialogs(wdDialogEditPasteSpecial).Show returns a value to indicate which button the user clicked in the dialog:
0 (False) = Cancel
-1 (True) = OK
So you could use
If Application.Dialogs(wdDialogEditPasteSpecial).Show Then
' user clicked OK
....
Else
' user clicked Cancel
...
End If
Hans,
Yes just done that works fine
thank you...... liz
ps what I should say is I've used the following which is the same idea:
ErrHandler:
Select Case Err
Case 4605
' can't paste - ignore
Case vbCancel
Exit Sub
Case Else
MsgBox Err.Description, vbExclamation
End Select
Is there any reason that I shouldn't do it this way?
I don't think that would work. Canceling the Paste Special dialog doesn't cause an error, and if it did, the error code wouldn't have been equal to vbCancel (=2).