PDA

View Full Version : Problem with PasteSpecial



sntnknd
08-30-2007, 05:46 AM
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

Anne Troy
08-30-2007, 03:38 PM
Sounds like it's pasting in two different layout modes. After pasting using the first method, double-click the graphic, go to the layout tab and see what the text wrapping is set at. Do the same using the second pasting method. Would seem the first is perhaps inline with text and the second is on top?

sntnknd
08-31-2007, 01:49 AM
Hello Anne,

You are absolutely correct! I just now checked this point and found:
PasteSpecial -> Layout is "In Front of Text"
Paste -> Layout is "In Line with Text"

But I am not sure how to change these settings runtime and make PasteSpecial layout to behave the same as Paste. Could you kindly suggest.

Thanks a lot.

cheers,
SanK

Anne Troy
08-31-2007, 05:54 AM
I don't do code. I'm sure someone will join us. :)

mdmackillop
09-01-2007, 04:29 AM
Can you post a sample signature file so we can see what's going on? Zip it and post it using Manage Attachments in the Go Advanced section

sntnknd
09-11-2007, 02:59 AM
Dear mdmackillop,

Thank you very much for your response and sorry for my delayed response. I have uploaded the sample signature file for your kind reference.

To open this file, you need to enter "schiefer" as password.

Best Regards,
sntnknd

fionabolt
09-17-2007, 04:21 AM
I cannot open your sample file. However, I think this will solve your problem?

Selection.Collapse Direction:=wdCollapseStart
Selection.Range.PasteSpecial placement:=wdInLine