copy full screen PowerPoint slideshow image and paste into MS Wordthrough vba code

R

RC

I am trying to view a slide full screen and then print screen or
capture the screen
then change to Word
then paste the image into Word
return to ppt and repeat for the all slides
The code below gets started but the screenshot is not the full screen
and the paste part is not working.
I can't use any utilites like snagit on these PCs. Any ideas for vb
code to paste into Word from PPT?
==========================================
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal
_
bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Const VK_SNAPSHOT = &H2C

Sub PrintScreen()
ActivePresentation.SlideShowSettings.Run
keybd_event VK_SNAPSHOT, 1, 0, 0

ReturnValue = Shell("winword.EXE", 1)
SendKeys "^(v)"
End Sub
 
S

Steve Rindsberg

I am trying to view a slide full screen and then print screen or
capture the screen
then change to Word
then paste the image into Word
return to ppt and repeat for the all slides
The code below gets started but the screenshot is not the full screen
and the paste part is not working.
I can't use any utilites like snagit on these PCs. Any ideas for vb
code to paste into Word from PPT?
==========================================
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal
_
bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Const VK_SNAPSHOT = &H2C

Sub PrintScreen()
ActivePresentation.SlideShowSettings.Run
keybd_event VK_SNAPSHOT, 1, 0, 0

ReturnValue = Shell("winword.EXE", 1)
SendKeys "^(v)"
End Sub

Wouldn't you be better off using PowerPoint's Slide.Export method to export the
slide to a graphics file, then import that into Word programmatically?
 
R

RC

Wouldn't you be better off using PowerPoint's Slide.Export method to export the
slide to a graphics file, then import that into Word programmatically?

--
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================- Hide quoted text -

- Show quoted text -
Thanks for your response.
I tried saving the slides in various graphic formats and inserting
them into Word and the quality is not as good as when I used full-
screen, print-screen, copy and paste. Is there a programmatic way to
export that can provide high quality?
 
S

Steve Rindsberg

Rc said:
Thanks for your response.
I tried saving the slides in various graphic formats and inserting
them into Word and the quality is not as good as when I used full-
screen, print-screen, copy and paste. Is there a programmatic way to
export that can provide high quality?

Saving is not the same as using Slide.Export (which allows you to specify the
resolution). A lot depends on the version of PPT though ... recent versions have a
tendency to export junk images.

One workaround is to export at much higher resolution then downsample (you can call
something like IrfanView from the command line to batch downsample images).

And if you use PPT 2007, don't apply SP1. It makes image exports break.
 
R

RC

Saving is not the same as using Slide.Export (which allows you to specify the
resolution).  A lot depends on the version of PPT though ... recent versions have a
tendency to export junk images.  

One workaround is to export at much higher resolution then downsample (youcan call
something like IrfanView from the command line to batch downsample images)..

And if you use PPT 2007, don't apply SP1.  It makes image exports break.

--
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================- Hide quoted text -

- Show quoted text -

Thank you very much for the help. I have spent many hours trying
various ways to export and the image quality of the slide is always
reduced. If anyone has any ideas to improve the quality or use some
parameters in the code to define and improve the quality, etc., it
would be appreciated. I've been using code like this:
====================
With ActivePresentation
.Export path:="c:\data", FilterName:="jpg", scalewidth:=1600,
scaleheight:=800
====================
I made the changes to the registry recommended by Microsoft.
 
S

Steve Rindsberg

Rc said:
Thank you very much for the help. I have spent many hours trying
various ways to export and the image quality of the slide is always
reduced. If anyone has any ideas to improve the quality or use some
parameters in the code to define and improve the quality, etc., it
would be appreciated. I've been using code like this:
====================
With ActivePresentation
.Export path:="c:\data", FilterName:="jpg", scalewidth:=1600,
scaleheight:=800
====================
I made the changes to the registry recommended by Microsoft.

You're still not doing what I suggested. Use the *SLIDE.EXPORT* method, not
Presentation.Export. You'll have to call this once per slide. For example:

Dim oSl As Slide
For Each oSl In ActivePresentation.Slides
Call oSl.Export(FileName:="C:\Temp\Slide" & CStr(oSl.SlideIndex) & ".JPG", _
filtername:="JPG", _
ScaleWidth:=1024, _
ScaleHeight:=768)
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top