2017-06-15 71 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