How to save a current slide as a picture in Visual Basic

5 pts.
Tags:
Visual Basic
I have searched for a method to save current slide as a picture in Slideshow mode, when pressing an action button on the slide. This is what I came up with in the end:
`Sub SaveCurrentSlideAsJpg()`
Dim imagePath As String
Dim slideNum As Integer
imagePath = "C:UsersXXXXXPicturesSlides"
slideNum = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex

' first check if this already exists then delete it
If Dir(imagePath & ActivePresentation.Name & "_" & slideNum & ".jpg") <> ""
Then
Kill imagePath & ActivePresentation.Name & "_" & slideNum & ".jpg"
End If

' now save the slide
ActivePresentation.SlideShowWindow.View.Slide.Export _
FileName:=imagePath & ActivePresentation.Name & "_" & slideNum & ".jpg", _
FilterName:="JPG"
End Sub
This is fine except that it saves to a default location on my PC. I will be giving this to other people and I need a dialog that pops up every time they try to save asking them where to save. All my attempts incorporate the Saveas dialog were unsuccessful. I would appreciate if anyone could help me with this. Thanks
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

If you want to save a current slide as a picture in Visual Basic, you need to change the format of the slide from a PowerPoint or another format into a JPG image. To do this, use VBA Visual Basic for Applications. The code is this:

Sub Save_PowerPoint_Slide_as_Images(). 

Then, you can use the Dim command to set your image attributes such as height, width and more. You’ll need to do this separately for each slide in your presentation that you want to change into a picture in Visual Basic.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: