- Joined
- Feb 2, 2009
- Messages
- 1
- Reaction score
- 0
Hey guys,
I am new to the site as a member, but have been poking around here for a while. Anyways, I am trying to write a macro that does the following after a user has copied *something*:
Here is what I have so far:
Obviously, what that does is do both commands... Which isn't very helpful... How can I get it to discern whether it is just text or an excel chart that it is pasting, and then apply the appropriate paste option?
I am new to the site as a member, but have been poking around here for a while. Anyways, I am trying to write a macro that does the following after a user has copied *something*:
- Try to paste the selection as a metafile (if it is an image)
- Try to paste the selection as un-formatted text (if it is a paragraph)
- Try to paste selection as value (if a formula)
- Return a simple error message if all else fails
Here is what I have so far:
Code:
On Error Resume Next
Selection.PasteSpecial DataType:=wdPasteEnhancedMetafile
Selection.PasteAndFormat (wdFormatPlainText)
If Err.Number <> 0 Then
MsgBox "Error Pasting Text:" _
& Chr(10) & "- Error #" & Err.Number & " " & Err.Description
ErrorRecord = 0
End If
End Sub
Obviously, what that does is do both commands... Which isn't very helpful... How can I get it to discern whether it is just text or an excel chart that it is pasting, and then apply the appropriate paste option?