2017-06-15 78 views

回答

0

其实解决方法很简单。必须记住形状的高度和Widht。

Copy the shape the clipboard, delete it and then paste it back as a vector image 
Private Function ReplaceChart(oSld As Slide, oShp As Shape) 
    Dim shpTop As Single 
    Dim shpleft As Single 
    Dim shpWidth As Single 
    Dim shpHeight As Single 


    ' Save the chart position 
    shpTop = oShp.Top 
    shpleft = oShp.Left 
    shpWidth = oShp.Width 
    shpHeight = oShp.Height 

    ' Copy, delete and paste the shape back as a picture 
    oShp.Copy 
    oShp.Delete 
    ActiveWindow.View.PasteSpecial ppPasteEnhancedMetafile 

    ' Get a reference to the new picture which will be the last shape in the shapes collection 
    Set oShp = oSld.Shapes(oSld.Shapes.Count) 

    ' Restore the chart picture position 
    oShp.Top = shpTop 
    oShp.Left = shpleft 
    oShp.Width = shpWidth 
    oShp.Height = shpHeight