Pastespecial how to not mess up manual format

nguyen_tri

New Member
Joined
Oct 17, 2017
Messages
9
I am trying to paste special and manually format the object to a certain scale. However, the scale size always changes. Here is my code:
Code:
With Selection.Tables(1).Range.Cells(2).Range    .PasteSpecial Link:=True, DataType:=wdPasteOLEObject, _
    Placement:=wdFloatOverText, DisplayAsIcon:=False
    With .ShapeRange(1)
    .LockAspectRatio = msoFalse
    .ScaleWidth 1.03, msoTrue
    .ScaleHeight 0.95, msoTrue
    .LockAspectRatio = msoTrue
    .ConvertToInlineShape
    End With
Please help me.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Most likely, the problem you're having is due to the object being linked; the field code that maintains the link maintains not only the data but also the formatting. There are also some things you can do through the GUI that there's no VBA support for. This seems to be one of them. Even manipulating the resulting LINK field's code won't produce the result you're after. Furthermore, even if you were able to, the linked object's format is liable to change when the Excel workbook is changed. What you may need to do is to paste your range as an unlinked table in its own right, which you can then re-scale, then replace that table's individual cell contents with links to your Excel workbook. Either that or resign yourself to re-scaling the linked data manually after running your existing code.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top