none
accessing clipboard object RRS feed

  • Question

  • I'm trying to automate a "paste and resize" operation in PowerPoint using VBA.  For context, the image to be pasted into Powerpoint would typically just have been captured using the Windows "Snipping" tool.

    I've solved the "resize" protion of the problem with the following VBA code (assigned to a quick link in PowerPoint):

    With ActiveWindow.Selection.ShapeRange

        .ScaleHeight 0.5, msoTrue, msoScaleFromTopLeft

        .ScaleWidth  0.5, msoTrue, msoScaleFromTopLeft

        .Align msoAlignMiddles, msoTrue

        .Align msoAlignCenters, msoTrue

    End With

    However, the first half of the problem, i.e., accessing the image to be pasted FROM the clipboard eludes me.  The My.Computer.Clipboard object seems like the answer, but I cannot get a script involving that to run, in fact even the fragment below (for the My.Computer object) fails

    MsgBox("Computer name= " & My.Computer.Name)

    generating the error (run-time error '424', Object required).  Obviously I'm missing something simple, such as an "include" operation.

    What am I missing?


    Saturday, September 30, 2017 10:46 PM

All replies

  • Unless you have some vb.net code to show regarding how you get or set the clipboard data I think this is the wrong forum.

    Is there a VBA forum or PowerPoint?

    :)

    Sunday, October 1, 2017 2:35 PM
  • It might be a security issue. The clipboard can be abused to do things the user does not want so you might need to authorize it somehow but I don't know how.


    Sam Hobbs
    SimpleSamples.Info

    Sunday, October 1, 2017 8:38 PM