I am trying to copy from powerpoint to excel and trying to keep the power point formating.
For x = 1 To pptApp.ActivePresentation.Slides.Count
pptApp.ActivePresentation.Slides.Range(Array(x)).Select
pptApp.ActivePresentation.Sli开发者_如何学运维des.Range(Array(x)).Copy
pptApp.Windows(2).Activate
pptApp.ActiveWindow.View.Paste
pptApp.Windows(2).Activate
Next x
I'm currently using this to do the copy and it works fine, however it doesn't copy the formatting.
Any Ideas how to achieve this? Sp
On top of PaulStock's valid point, when you paste from one office application to another the buffer can be interpreted in many different ways by the importing program. In your case you want to make sure that Excel imports the PPT slide not as HTML, text, BMP or any other, but as a slide object. In the interactive mode you would use the PasteSpecial command, and a VBA aequivalent in Excel would be
[SheetObject].PasteSpecial Format:="Microsoft PowerPoint Slide Object", _
Link :=False, _
DisplayAsIcon:=False
quick & dirty testing: put this code in a sheet-onDoubleClick trigger, replacing [SheetObject] by "Me", move to PPT, copy a slide from the slide strip (!!!), go back to Excel and doubleclick a cell - and voi lá!
(here Office 2003 SP3)
精彩评论