从Excel中复制文本并将其粘贴到PowerPoint中,然后格式化复制的文本

我是一个非常新的编写VB脚本。 我能够从Excel复制文本(或范围),并将其粘贴在PowerPoint中,我想改变字体大小(12),把一个边框,并将背景设置为白色。 以下是我必须从Excel复制文本:

' ~~~~~~~~~~~~~ Sub Copy_ExcelText_Powerpoint_and_Format() ' This copies a range in excel and copy it in Powerpoint, and then formats it Dim PPApp As Object ' As PowerPoint.Application ' Reference existing instance of PowerPoint Set PPApp = GetObject(, "Powerpoint.Application") Sheets("Sheet1").Range("J2:J4").copy PPApp.ActivePresentation.Slides(1).Shapes.PasteSpecial DataType:=10, Link:=0 ' now format the text ' ....... ' ~~~~~~~~~~~~~ 

我发现一些脚本会改变活动幻灯片中所有文本的字体,但是我只想改变刚刚从Excel复制的文本的字体大小(等等)。 任何帮助将不胜感激。 非常感谢!

可能3,2014编辑

你好,我想过一个不同的方法,而不是做一个粘贴,我会做一个AddTextbox,但它给我一个“运行时错误13types不匹配”的错误。

下面是修改后的脚本:'~~~~~~~~~~~~~ Sub Copy_ExcelText_Powerpoint_and_Format()'这个复制一个范围在Excel中,并将其复制到Powerpoint中,然后将其格式化Dim PPApp As Object'As PowerPoint.Application

 ' Reference existing instance of PowerPoint Set PPApp = GetObject(, "Powerpoint.Application") 'Sheets("Sheet1").Range("J2:J4").copy --commented out 'PPApp.ActivePresentation.Slides(1).Shapes.PasteSpecial DataType:=10, Link:=0--commented out ' use addtextbox instead Set PPSlide = PPPres.Slides _ (PPApp.ActiveWindow.Selection.SlideRange.SlideIndex) With PPSlide ' create textbox Set tBox = .Shapes.AddTextbox( _ Orientation:=msoTextOrientationHorizontal, _ Left:=1, _ Top:=250, _ Width:=720, _ Height:=100) ' set content tBox.TextFrame.TextRange.Text = Sheets("Sheet1").Range("M2").Value ' Set format tBox.Font.Bold = False tBox.Font.Name = "Arial (Headings)" tBox.Font.Size = 12 tBox.ParagraphFormat.Alignment = ppAlignCenter End With 

感谢任何帮助,我可以得到。 谢谢。