+ Reply to Thread
Results 1 to 3 of 3

Copy & paste image from UserForm

  1. #1
    pmartin1960@hotmail.com
    Guest

    Copy & paste image from UserForm

    Hi all

    Is there an easy way to enable cut & paste from an image on a UserForm
    (to another app, say Word). I have an Image control that displays a
    chart GIF. I would like the user to be able to right-click and cut &
    paste in the usual Windows manner. Are there some APIs that enable
    this?

    Thanks in advance

    Paul Martin
    Melbourne, Australia


  2. #2
    Michel Pierron
    Guest

    Re: Copy & paste image from UserForm

    Hi pmartin,
    You can try:

    Private Declare Function OpenClipboard& _
    Lib "user32" (ByVal hwnd&)
    Private Declare Function EmptyClipboard& _
    Lib "user32" ()
    Private Declare Function SetClipboardData& _
    Lib "user32" (ByVal wFormat&, ByVal hMem&)
    Private Declare Function CloseClipboard& _
    Lib "user32" ()

    Private Sub Image1_MouseDown(ByVal Button% _
    , ByVal Shift%, ByVal X!, ByVal Y!)
    If Button = 2 Then
    On Error GoTo Bug
    Application.CommandBars.FindControl(ID:=809).Execute
    Dim hCopy&
    OpenClipboard 0&
    EmptyClipboard
    hCopy = SetClipboardData(2, Me.Image1.Picture.Handle)
    CloseClipboard
    Me.Image1.Picture = LoadPicture("")
    Me.Repaint
    End If
    Bug:
    End Sub

    MP

    <pmartin1960@hotmail.com> a écrit dans le message de news:
    1115258039.674959.87510@o13g2000cwo.googlegroups.com...
    > Hi all
    >
    > Is there an easy way to enable cut & paste from an image on a UserForm
    > (to another app, say Word). I have an Image control that displays a
    > chart GIF. I would like the user to be able to right-click and cut &
    > paste in the usual Windows manner. Are there some APIs that enable
    > this?
    >
    > Thanks in advance
    >
    > Paul Martin
    > Melbourne, Australia
    >




  3. #3
    Paul Martin
    Guest

    Re: Copy & paste image from UserForm

    Hi Michel

    Thanks for your response, which is not quite what I'm after. Your code
    opens the Office Clipboard, but it is not pasting anything to it when I
    tried it. If I were to pursue this path, I would need to be able to
    define the name or caption of the object in the clipboard.

    What I would really like is to right-click the image object on the
    form, copy and paste to say Word or some other app.

    Regards

    Paul Martin
    Melbourne, Australia


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1