Results 1 to 8 of 8

Thread: paste screen shot from clipboard into PowerPoint

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2004
    Posts
    4

    Question paste screen shot from clipboard into PowerPoint

    Here's what I'm trying to do. I have published an internet map site on our intranet where local users can create their own custom maps.

    I want to create a button on that webpage (using a combination VB and ASP) that when clicked will take a snap shot of the active window (the map they have created) and paste it to their clipboard. Then I want to launch PowerPoint on their workstation, add a blank slide, and paste the snap shot from their clipboard onto that blank slide.

    Is this possible? I have some code, but I would like someone with more VB experience than me to check it out. I have tested it on my computer by sticking the code behind a command button on a user form in MS Word, and it runs fine up until the last 3 or 4 lines of code (the paste from clipboard part). I get a run-time error '424': object required error on the line: Set Picture = Clipboard.GetData(vbCFBitmap).

    Any advice? Here is the code:

    VB Code:
    1. Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _
    2. ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    3.  
    4. Private Const VK_SNAPSHOT = &H2C
    5.  
    6. ' Get the Active Window
    7. keybd_event vbKeySnapshot, 1, 0, 0
    8.  
    9. Dim ppApp
    10. Set ppApp = CreateObject("Powerpoint.Application")
    11. ' Make it visible.
    12. ppApp.Visible = True
    13.  
    14. ' Add a new presentation.
    15. Dim ppPres
    16. Set ppPres = ppApp.Presentations.Add(msoTrue)
    17.  
    18. ' Add a new slide.
    19. Dim ppSlide1
    20. Set ppSlide1 = ppPres.Slides.Add(1, 1)
    21.  
    22. ' Add the image.
    23. Dim Picture
    24. Set Picture = Clipboard.GetData(vbCFBitmap)
    25. ppSlide1.Shapes.AddPicture (Picture)
    Last edited by GIO; Sep 16th, 2004 at 07:32 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width