Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with PasteSpecial feature

Status
Not open for further replies.

sntnkndg

Programmer
Jun 18, 2007
5
DE
Hello Everybody,

I am facing one strange problem in one of my VBA applications. The application uses the normal "Paste" to paste one copied signature file. I would like to use the "PasteSpecial" feature instead, so that only the text of the signature file gets inserted and not its background shade.

My code snippet:

With Selection
.Range.PasteSpecial datatype:=wdPasteEnhancedMetafile
End With

The change works fine with a certain defect.

Using normal "Paste", if 2 signature files are pasted one after the other, then the 2nd signature file comes in front of the 1st, which is correct.

But using "Paste Special", I find that the 2nd signature file gets pasted on top of the 1st! This is not something that I want.

I am unable to understand why and how to make it work the way it used to for normal "Paste". Could anyone of you experts give me some advice please.

Thanks in advance.

cheers,
SanK
 
This is to do with pasting objects rather than text. When you paste an object, the standard practice is to shift other objects down. When you paste text, ther eis no object to shift. You will therefore need to change the range in which you are pasting for each paste operation if you want to use pastespecial



Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Hello Geoff,

Thank you very much for your response. I understand that this is a basic behavioral difference between Paste and PasteSpecial.

But I am not sure how to change the range. I tried using Collapse, but that didn't work:

Code
----
Selection.Collapse Direction:=wdCollapseStart
----

Could you kindly suggest how can I achieve the same results as Paste, but using PasteSpecial to avoid the background shade.

Thanks for your help.

cheers,
SanK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top