none
Clipboard-content into file (VBA) update 7.4.20 RRS feed

  • Question

  • I am using Windows 10, Office 365, Access
    I want to paste a Picture into some Control of a MSAccess form (e.g. an Image Control or other)

    I found this:

    Private Sub cmdPaste_Click()
    Me!txtNotes.SetFocus
    DoCmd.RunCommand acCmdPaste
    EndSub
    This Routine works
    fine with text!
    but what about a Picture? is there a comparable method for Pictures?
    I get error 2046: "paste not available" every time I try.
    what kind of Control(-properties) and VBA Commands would do the trick?



    Monday, April 6, 2020 3:34 PM

All replies

  • Hi Walter -

    You might try the access Help file at 

    There's stuff in there beyond me, but it's a good place to start


    peter n roth - http://PNR1.com, Maybe some useful stuff

    Monday, April 6, 2020 4:30 PM
  • Cannot find any sensible method for
    "Clipboard-content into/from file", using VBA from Access, preferably with the help of VBA-objects or form-controls

    Hi Walter,

    Do you know the use of   ctl-C   and   ctl-V?

    Imb.

    Monday, April 6, 2020 5:25 PM
  • Yes, I know ctl-V, but I don't want my customers to use it. I want them to organize and even to edit pictures incl. screenshots via a form with a suitable table as its recordsource. And I would like the pictures to be stored in a definite type, e.g. jpg, or at least in a type I know.

    Like this: the user opens my form, defines a new record, then opens a picture in some application, takes a carefully selected screenshot and stores it in the new record by pressing a command button on my form. And I would like to control exactly what this button does. 

    The whole procedure has been successfully realized with picture files from a folder as source. But I want to provide clipboard products as a second source, as long as it works under my strict procedural control.
    Ctl-V is too evasive and too dangerous for this purpose.

    For instance (ideas collected from some - evasive - formulations of some User Groups):

    DEF PO AS Object
    . . . 
    PO.GetInfoFromClipboard
    IF PO.Type IS IN (vbJPG, vbBMP, vbGIF, vbPNG) THEN
      (Write PO.Content into a Buffer file and then switch to the file method mentioned above)
    END IF

    This is a sensible idea, and I didn't invent it myself. Can it be done in VBA? Where is the Problem?
    Thanks for any help.

    Monday, April 6, 2020 6:43 PM
  • Like this: the user opens my form, defines a new record, then opens a picture in some application, takes a carefully selected screenshot and stores it in the new record by pressing a command button on my form. And I would like to control exactly what this button does. 

    Hi Walter,

    Alas, I have no experience with the process that you describe. For the simple reason that I never store picture-information in a table, but only a reference to an external file, in terms of map and filename.

    Some time ago I made an application with some related issue. Users placed files (could be any file) in some defined map. Then based on the contents (defined by the user) of the file, the file was renamed and moved to some destination map. In a new record this new filename and destination map are stored.

    Imb.

    Monday, April 6, 2020 9:21 PM
  • Hi Peter,

    thanks for your suggestions, I got new information, but I am still on my way

    Tuesday, April 7, 2020 7:26 PM