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:
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 ' Get the Active Window keybd_event vbKeySnapshot, 1, 0, 0 Dim ppApp Set ppApp = CreateObject("Powerpoint.Application") ' Make it visible. ppApp.Visible = True ' Add a new presentation. Dim ppPres Set ppPres = ppApp.Presentations.Add(msoTrue) ' Add a new slide. Dim ppSlide1 Set ppSlide1 = ppPres.Slides.Add(1, 1) ' Add the image. Dim Picture Set Picture = Clipboard.GetData(vbCFBitmap) ppSlide1.Shapes.AddPicture (Picture)




Reply With Quote