?
Solved

VBA - Exporting some contents of a userform to a Power point presentation

Posted on 2006-11-06
5
Medium Priority
?
283 Views
Last Modified: 2013-12-26
Hi,

This question is related to VBA in Excel.

I have a userform with different controls on it.
I'd like to convert some controls to a picture and insert this in a Power point presentation.

How can I do that?

Thanx for your help.
0
Comment
Question by:Wongy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 13

Expert Comment

by:jmundsack
ID: 17883098
I would recommend the following:

1. while the user form is open, press Alt-PrintScreen on the keyboard

(this copies the current form--as a picture--into the Windows clipboard)

2. go into PowerPoint
3. do Edit>Paste, or simply press Ctrl-V

Voila!
0
 
LVL 13

Expert Comment

by:jmundsack
ID: 17883117
If you only want certain parts of the userform in the picture that you're inserting into PowerPoint, there are a couple options:

1. Instead of pasting the image into PowerPoint, paste it into the Windows "Paint" program
2. highlight the control(s) you want in the PowerPoint image and do Edit>Copy or simply press Ctrl-C
3. then go into PowerPoint
4. do Edit>Paste, or simply press Ctrl-V

Other option:

1. find and download a freeware or shareware "screen capture" utility that allows you to select a specific region of the screen and copy it to the clipboard.
2. go into PowerPoint
3. do Edit>Paste, or simply press Ctrl-V

HTH-Jon
0
 
LVL 1

Author Comment

by:Wongy
ID: 17884133
Hi,

Actually I wanted to do this with VBA, so by just pressing a button. And I found the way.

Here it is:

First indeed we need to send the form to the clipboard.
==> cf http://support.microsoft.com/kb/240653/en-us

Then we export the content of the clipboard to PowerPoint. This way:

    Dim PPApp
    Dim PPPres
    Dim PPSlide, ppLayoutBlank
     
    Set PPApp = CreateObject("Powerpoint.Application")
     
    Set PPPres = PPApp.Presentations.Add
    Set PPSlide = PPPres.Slides.Add(1, 11)
     
    PPApp.Visible = True
    PPApp.ActiveWindow.View.Paste

    Set PPSlide = Nothing
    Set PPPres = Nothing
    Set PPApp = Nothing


Since I wanted to keep only certain controls on the form, before sending its content to the clipboard, I do this:
    For Each myCtrl In Me.Controls
        If Not LCase(myCtrl.Name) Like "*_show" Then
            myCtrl.Visible = False
        End If
    Next myCtrl

And I noticed that if I send now the content to the clipboard, all the content is sent (including the ones that are supposed to be hidden).
So I do this, before running the sub routine regarding the clipboard:

    newHour = Hour(Now())
    newMinute = Minute(Now())
    newSecond = Second(Now()) + 1
    waitTime = TimeSerial(newHour, newMinute, newSecond)

    Application.Wait waitTime


That's it.
Thanx.
0
 
LVL 1

Accepted Solution

by:
kodiakbear earned 0 total points
ID: 17975509
Closed, 135 points refunded.
kb
Experts Exchange Moderator
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question