Results 1 to 4 of 4
  1. #1
    HansJ is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    May 2016
    Posts
    9

    Copy a string to paste into another program

    Is there an easy simple way to copy a string value in the line of code to paste into a different program? I have found several different ways but it sure looks convoluted...
    Something as simple as
    Dim strWhere as String
    strWHere ="This is the text I need to copy"
    ??? How would I call this string and pass it off to the DoCmd?


    DoCmd.RunCommand acCmdCopy

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    its not an access command but a windows command:
    clipboard.SetText strWhere
    clipboard.PutInClipboard

  3. #3
    HansJ is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    May 2016
    Posts
    9
    ranman I tried that and get a runtime 91 error on line clipboard.SetText strWhere

    Code:
    Private Sub Command100_Click()
    Dim strWhere As String
    Dim clipboard As Object
    strWhere = "This is what I want"
    clipboard.SetText strWhere
    clipboard.PutInClipboard

  4. #4
    Micron is online now Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Code:
    Dim clipboard As MSForms.DataObject
    Set clipboard = New MSForms.DataObject
    clipboard.SetText "A string value"
    clipboard.PutInClipboard
    And you need a reference to the Forms (2.0?) library.
    The alternative is an API call, but I presume that's what you meant by 'convoluted'.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Copy and Paste Row (vb)
    By Computer202 in forum Programming
    Replies: 7
    Last Post: 03-28-2014, 01:59 AM
  2. Any way to copy paste records from
    By super12 in forum Access
    Replies: 5
    Last Post: 03-05-2013, 11:16 PM
  3. Copy-Paste on Internet
    By BorisGomel in forum Access
    Replies: 5
    Last Post: 11-09-2011, 10:33 AM
  4. Copy-Paste
    By BorisGomel in forum Access
    Replies: 4
    Last Post: 10-25-2011, 07:17 AM
  5. Copy / Paste some fields
    By isnpms in forum Access
    Replies: 2
    Last Post: 08-25-2010, 10:13 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
  •  
Other Forums: Microsoft Office Forums