Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2006-11-06
5
Medium Priority
?
288 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses

618 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