stickerman
New Member
- Joined
- Jan 15, 2013
- Messages
- 5
Hi. I am a comparatively novice programmer and have recently come across the ability to create a Powerpoint direct from VBA in Excel. Most of what I want to do is working, with the following exception.
If I manually copy some text from Excel and paste them to an open powerpoint, I have 5 options for posting. The first two offer what I want: to keep the text size etc and be able to later it in Powerpoint - particularly I want to add a drop shadow. However, when I do this using VBA I can obviously copy and paste, but the resulting image doesn't allow me to access / alter the text. The programming lines I have involved are:
Dim r, s, SheetNo, SheetPosition
Dim rng As Range
Dim PowerPointApp As Object
Dim myPresentation As Object
Dim mySlide As Object
Dim myShape As Object
Set PowerPointApp = CreateObject(class:="PowerPoint.Application")
'Create a New Presentation
Set myPresentation = PowerPointApp.Presentations.Add
myPresentation.PageSetup.SlideSize = 1
'Add a slide to the Presentation
Set mySlide = myPresentation.Slides.Add(SheetNo, 12)
'Copy Excel Range
Set rng = ThisWorkbook.Worksheets("Slide 2").Range("a21:i41")
rng.Copy
'Paste to PowerPoint and position
mySlide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile
Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
Can anyone tell me what I need to do to change this? I would guess the answer is somewhere in the "mySlide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile" sctions, but I'm out of my depth here.
Thanks for any help
If I manually copy some text from Excel and paste them to an open powerpoint, I have 5 options for posting. The first two offer what I want: to keep the text size etc and be able to later it in Powerpoint - particularly I want to add a drop shadow. However, when I do this using VBA I can obviously copy and paste, but the resulting image doesn't allow me to access / alter the text. The programming lines I have involved are:
Dim r, s, SheetNo, SheetPosition
Dim rng As Range
Dim PowerPointApp As Object
Dim myPresentation As Object
Dim mySlide As Object
Dim myShape As Object
Set PowerPointApp = CreateObject(class:="PowerPoint.Application")
'Create a New Presentation
Set myPresentation = PowerPointApp.Presentations.Add
myPresentation.PageSetup.SlideSize = 1
'Add a slide to the Presentation
Set mySlide = myPresentation.Slides.Add(SheetNo, 12)
'Copy Excel Range
Set rng = ThisWorkbook.Worksheets("Slide 2").Range("a21:i41")
rng.Copy
'Paste to PowerPoint and position
mySlide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile
Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
Can anyone tell me what I need to do to change this? I would guess the answer is somewhere in the "mySlide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile" sctions, but I'm out of my depth here.
Thanks for any help