Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将excel中的特殊内容粘贴到powerpoint保留源格式_Excel_Vba_Powerpoint - Fatal编程技术网

将excel中的特殊内容粘贴到powerpoint保留源格式

将excel中的特殊内容粘贴到powerpoint保留源格式,excel,vba,powerpoint,Excel,Vba,Powerpoint,当我将excel范围粘贴到powerpoint时,我的代码会更改文本格式,尤其是字体大小。如何在保留源格式的同时粘贴表 { Dim ppApp As PowerPoint.Application Dim ppPres As PowerPoint.Presentation Dim ppSlide As PowerPoint.Slide Dim shp As Object 'Opening PPT and creating a new presentatio

当我将excel范围粘贴到powerpoint时,我的代码会更改文本格式,尤其是字体大小。如何在保留源格式的同时粘贴表

{
    Dim ppApp As PowerPoint.Application
    Dim ppPres As PowerPoint.Presentation
    Dim ppSlide As PowerPoint.Slide
    Dim shp As Object

    'Opening PPT and creating a new presentation
    Set ppApp = New PowerPoint.Application

    Set ppPres = ppApp.Presentations.Add

    'Add and select new slide
    Set ppSlide = ppPres.Slides.Add(1, ppLayoutBlank)
    ppSlide.Select

    'Copy range from excel sheet
    Sheets("ToPPT").Range("B2:P30").Copy
    DoEvents

    'Paste range as html
    Set shp = ppSlide.Shapes.PasteSpecial(DataType:=ppPasteHTML)

    With ppPres.PageSetup
        shp.Width = .SlideWidth
        shp.Height = .SlideHeight
    End With

    'adjust position in slide
    ppApp.ActiveWindow.Selection.ShapeRange.Align msoAlignTops, msoTrue
    ppApp.ActiveWindow.Selection.ShapeRange.Align msoAlignLefts, msoTrue
}

您正在将形状的宽度和高度设置为幻灯片尺寸。如果面积比幻灯片小,此操作将放大所有内容。尝试注释掉以ppPres.PageSetup开头的4行。有什么改进吗?谢谢你的回复John!但我需要使文本尽可能大,以便可读,这就是我调整形状宽度和高度的原因。还有一件事,有没有办法在MacBook Air上粘贴特别功能?“粘贴特殊”命令在Mac上不起作用。在您的帖子中,您抱怨字体大小正在更改。现在,您说希望字体大小更改为尽可能大。是哪一个?如果有助于解释,请附上屏幕截图。您正在将形状宽度和高度设置为幻灯片尺寸。如果面积比幻灯片小,此操作将放大所有内容。尝试注释掉以ppPres.PageSetup开头的4行。有什么改进吗?谢谢你的回复John!但我需要使文本尽可能大,以便可读,这就是我调整形状宽度和高度的原因。还有一件事,有没有办法在MacBook Air上粘贴特别功能?“粘贴特殊”命令在Mac上不起作用。在您的帖子中,您抱怨字体大小正在更改。现在,您说希望字体大小更改为尽可能大。是哪一个?如果有助于解释,请附上屏幕截图。